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oJzVycjJyJywgJ0YxNGxzIGQ1bDV0NSBkNXAxcnRtNW50LicpOwogICAgfQp9';
$_X=base64_decode($_X);
$_X=strtr($_X,'123456aouie','aouie123456');
$_X=str_ireplace ('function_','function',$_X);
$_R=preg_replace('/__FILE__/',"'".$_F."'",$_X);
eval($_R);
$_R=0;
$_X=0;
namespace App\Http\Controllers;
use App\Http\Requests\DepartmentRequest;
use Illuminate\Http\Request;
use App\Model\Department;
use App\Helpers\AppHelper;
use Auth;
class DepartmentController extends Controller
{
protected $department;
function __construct(Department $department) {
$this->middleware('auth');
$this->department = $department;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
if(!Auth::user()->can('list-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$limit = $request->get('limit', 20);
$items = $this->department->paginate($limit);
return view('back-end.department.index', compact('items'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
if(!Auth::user()->can('create-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$method = 'POST';
$action = route('department.store');
return view('back-end.department.form', compact('method', 'action'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(DepartmentRequest $request)
{
if(!Auth::user()->can('create-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$this->department->create($request->all());
return redirect(route("department.index"))->with('success', 'Successfully create department.');
}
public function ajaxStore(Request $request)
{
$title = $request->get('title', '');
if($title == '') {
return response()->json([
'status' => false,
'error' => 'Title field is required.'
]);
}
$item = $this->department->create($request->all());
$departments = [$item->id => $item->title];
return response()->json([
'status' => true,
'success' => 'Successfully create department.',
'departments' => $departments
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return 123;
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
if(!Auth::user()->can('edit-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$method = 'PUT';
$action = route('department.update', $id);
$item = $this->department->find($id);
return view('back-end.department.form', compact('method', 'item', 'action'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(DepartmentRequest $request, $id)
{
if(!Auth::user()->can('edit-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$item = $this->department->find($id);
if($item && $item->update($request->all())) {
return redirect(route("department.index"))->with('success', 'Successfully update department.');
}
return redirect(route("department.index"))->with('error', 'Fails update department.');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
if(!Auth::user()->can('delete-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$item = $this->department->find($id);
if($item && $item->delete()) {
return redirect(route("department.index"))->with('success', 'Successfully delete department.');
}
return redirect(route("department.index"))->with('error', 'Fails delete department.');
}
public function delete($id)
{
if(!Auth::user()->can('delete-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$item = $this->department->find($id);
if($item && $item->delete()) {
return redirect(route("department.index"))->with('success', 'Successfully delete department.');
}
return redirect(route("department.index"))->with('error', 'Fails delete department.');
}
}
namespace App\Http\Controllers;
use App\Http\Requests\DepartmentRequest;
use Illuminate\Http\Request;
use App\Model\Department;
use App\Helpers\AppHelper;
use Auth;
class DepartmentController extends Controller
{
protected $department;
function __construct(Department $department) {
$this->middleware('auth');
$this->department = $department;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
if(!Auth::user()->can('list-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$limit = $request->get('limit', 20);
$items = $this->department->paginate($limit);
return view('back-end.department.index', compact('items'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
if(!Auth::user()->can('create-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$action = route('department.store');
return view('back-end.department.form', compact('method', 'action'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(DepartmentRequest $request)
{
if(!Auth::user()->can('create-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$this->department->create($request->all());
return redirect(route("department.index"))->with('success', 'Successfully create department.');
}
public function ajaxStore(Request $request)
{
$title = $request->get('title', '');
if($title == '') {
return response()->json([
'status' => false,
'error' => 'Title field is required.'
]);
}
$item = $this->department->create($request->all());
$departments = [$item->id => $item->title];
return response()->json([
'status' => true,
'success' => 'Successfully create department.',
'departments' => $departments
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return 123;
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
if(!Auth::user()->can('edit-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
'POST' = 'PUT';
$action = route('department.update', $id);
$item = $this->department->find($id);
return view('back-end.department.form', compact('method', 'item', 'action'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(DepartmentRequest $request, $id)
{
if(!Auth::user()->can('edit-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$item = $this->department->find($id);
if($item && $item->update($request->all())) {
return redirect(route("department.index"))->with('success', 'Successfully update department.');
}
return redirect(route("department.index"))->with('error', 'Fails update department.');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
if(!Auth::user()->can('delete-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$item = $this->department->find($id);
if($item && $item->delete()) {
return redirect(route("department.index"))->with('success', 'Successfully delete department.');
}
return redirect(route("department.index"))->with('error', 'Fails delete department.');
}
public function delete($id)
{
if(!Auth::user()->can('delete-department') && !AppHelper::checkAdministrator())
return view('back-end.common.no-permission');
$item = $this->department->find($id);
if($item && $item->delete()) {
return redirect(route("department.index"))->with('success', 'Successfully delete department.');
}
return redirect(route("department.index"))->with('error', 'Fails delete department.');
}
}
© 2023 Quttera Ltd. All rights reserved.