⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
crm.dev-unit.com
/
app
/
Http
/
Controllers
/
View File Name :
DepartmentController.php
<?php namespace App\Http\Controllers; use App\Http\Requests\CreateDepartmentRequest; use App\Http\Requests\UpdateDepartmentRequest; use App\Models\Department; use App\Repositories\DepartmentRepository; use Exception; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Http\Response; class DepartmentController extends AppBaseController { /** @var DepartmentRepository */ private $departmentRepository; public function __construct(DepartmentRepository $departmentRepo) { $this->departmentRepository = $departmentRepo; } /** * Display a listing of the Department. * * @return Factory|View */ public function index() { return view('departments.index'); } /** * Store a newly created Department in storage. * * @param CreateDepartmentRequest $request * @return Response */ public function store(CreateDepartmentRequest $request) { $input = $request->all(); $department = $this->departmentRepository->create($input); activity()->performedOn($department)->causedBy(getLoggedInUser()) ->useLog('New Department created.')->log($department->name.' Department created.'); return $this->sendResponse($department, __('messages.department.department_saved_successfully')); } /** * Show the form for editing the specified Department. * * @param Department $department * @return Response */ public function edit(Department $department) { return $this->sendResponse($department, 'Department retrieved successfully.'); } /** * Update the specified Department in storage. * * @param Department $department * @param UpdateDepartmentRequest $request * @return Response */ public function update(Department $department, UpdateDepartmentRequest $request) { $input = $request->all(); $department = $this->departmentRepository->update($input, $department->id); activity()->performedOn($department)->causedBy(getLoggedInUser()) ->useLog('Department updated.')->log($department->name.' Department updated.'); return $this->sendSuccess(__('messages.department.department_updated_successfully')); } /** * Remove the specified Department from storage. * * @param Department $department * @return Response * * @throws Exception */ public function destroy(Department $department) { activity()->performedOn($department)->causedBy(getLoggedInUser()) ->useLog('Department deleted.')->log($department->name.' Department deleted.'); $department->delete(); return $this->sendSuccess('Department deleted successfully.'); } }