芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/bit-alphas-ltd.com/user/project/app/Http/Controllers/Admin/SocialLinkController.php
middleware('auth:admin'); } public function datatables() { $datas = SocialLinks::orderBy('id','desc'); return Datatables::of($datas) ->editColumn('status', function(SocialLinks $data) { $status = $data->status == 1 ? __('Activated') : __('Deativated'); $status_sign = $data->status == 1 ? 'success' : 'danger'; return '
'.$status .'
'.__("Active").'
'.__("Deativate").'
'; }) ->addColumn('action', function(SocialLinks $data) { return '
'.'Actions' .'
'.__("Edit").'
'.__("Delete").'
'; }) ->rawColumns(['status','action']) ->toJson(); //--- Returning Json Data To Client Side } public function index() { return view('admin.sociallinks.index'); } public function create(){ return view('admin.sociallinks.create'); } public function store(Request $request){ $rules = [ 'icon' => 'required', ]; $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return response()->json(array('errors' => $validator->getMessageBag()->toArray())); } $data = new SocialLinks(); $input = $request->all(); $data->fill($input)->save(); $msg = 'New Data Added Successfully.'.'
View Social Links Lists
'; return response()->json($msg); } public function edit($id){ $data = SocialLinks::findOrFail($id); return view('admin.sociallinks.edit',compact('data')); } public function update(Request $request,$id){ $rules = [ 'icon' => 'required', ]; $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return response()->json(array('errors' => $validator->getMessageBag()->toArray())); } $data = SocialLinks::findOrFail($id); $input = $request->all(); $data->update($input); $msg = 'New Updated Successfully.'.'
View Social Links Lists
'; return response()->json($msg); } public function status($id1,$id2) { $data = SocialLinks::findOrFail($id1); $data->status = $id2; $data->update(); $mgs = __('Data Update Successfully.'); return response()->json($mgs); } public function destroy($id){ SocialLinks::findOrFail($id)->delete(); $mgs = __('Data Deleted Successfully.'); return response()->json($mgs); } }