module updated
This commit is contained in:
@ -18,15 +18,15 @@
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'index', ' Departments index');
|
||||
|
||||
$data = Departments::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
|
||||
|
||||
return view("crud.generated.departments.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'create', ' Departments create');
|
||||
|
||||
$TableData = Departments::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.departments.edit",compact('TableData','editable'));
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'store', ' Departments store');
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
@ -54,7 +54,7 @@
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
@ -69,24 +69,24 @@
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Departments Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('departments.index')->with('success','The Departments created Successfully.');
|
||||
return redirect()->route('department.index')->with('success','The Departments created Successfully.');
|
||||
}
|
||||
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Departments::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Departments::find($articleId);
|
||||
@ -97,22 +97,22 @@
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'show', ' Departments show');
|
||||
$data = Departments::findOrFail($id);
|
||||
|
||||
$data = Departments::findOrFail($id);
|
||||
|
||||
return view("crud.generated.departments.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'edit', ' Departments edit');
|
||||
|
||||
$TableData = Departments::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$data = Departments::findOrFail($id);
|
||||
$editable=true;
|
||||
@ -122,7 +122,7 @@
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'update', ' Departments update');
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
@ -159,7 +159,7 @@
|
||||
|
||||
public function destroy(Request $request,$id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'destroy', ' Departments destroy');
|
||||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -175,7 +175,7 @@
|
||||
}
|
||||
public function toggle(Request $request,$id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'destroy', ' Departments destroy');
|
||||
|
||||
$data = Departments::findOrFail($id);
|
||||
$requestData=['status'=>($data->status==1)?0:1];
|
||||
DB::beginTransaction();
|
||||
@ -193,7 +193,7 @@
|
||||
}
|
||||
public function clone(Request $request,$id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'clone', ' Departments clone');
|
||||
|
||||
$data = Departments::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
@ -211,8 +211,7 @@
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Departments Clonned Successfully.'],200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user