public function searchNewClass(Request $request) { $this->setMetadata('Lớp mới'); $status = $request->input('status'); $newclass = null; $limit = Config::findByKey('rows_per_page_article')->first()->value; if (is_null($status) || $status == "") { $newclass = NewClass::where('is_publish', 1)->orderBy('priority')->paginate($limit); } else { $newclass = NewClass::where('is_publish', 1)->where('status', $status)->orderBy('priority')->paginate($limit); } return view('frontend.sites.newClass', ['newclass' => $newclass]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { DB::transaction(function () use($id) { $user = Auth::user(); $class = NewClass::findOrFail($id); $class->updated_by = $user->name; $class->deleted_by = $user->name; $class->save(); // soft delete $class->delete(); }); }