where('title', 'like', '%'.request('q').'%'); $mstrCollections = $singleMstrQuery->paginate(25); return view('masters.index', compact('mstrCollections')); } /** * Show the form for creating a new singleMstr. * * @return \Illuminate\View\View */ public function create() { $this->authorize('create', new Master); return view('masters.create'); } /** * Store a newly created singleMstr in storage. * * @param \App\Http\Requests\Masters\CreateRequest $singleMstrCreateForm * @return \Illuminate\Routing\Redirector */ public function store(CreateRequest $singleMstrCreateForm) { $singleMstr = $singleMstrCreateForm->save(); return redirect()->route('masters.show', $singleMstr); } /** * Display the specified singleMstr. * * @param \App\Models\Master $singleMstr * @return \Illuminate\View\View */ public function show(Master $singleMstr) { return view('masters.show', compact('singleMstr')); } /** * Show the form for editing the specified singleMstr. * * @param \App\Models\Master $singleMstr * @return \Illuminate\View\View */ public function edit(Master $singleMstr) { $this->authorize('update', $singleMstr); return view('masters.edit', compact('singleMstr')); } /** * Update the specified singleMstr in storage. * * @param \App\Http\Requests\Masters\UpdateRequest $singleMstrUpdateForm * @param \fullMstr $singleMstr * @return \Illuminate\Routing\Redirector */ public function update(UpdateRequest $singleMstrUpdateForm, Master $singleMstr) { $singleMstr->update($singleMstrUpdateForm->validated()); return redirect()->route('masters.show', $singleMstr); } /** * Remove the specified singleMstr from storage. * * @param \Illuminate\Http\Request $request * @param \fullMstr $singleMstr * @return \Illuminate\Routing\Redirector */ public function destroy(Request $request, Master $singleMstr) { $this->authorize('delete', $singleMstr); $request->validate(['master_id' => 'required']); if ($request->get('master_id') == $singleMstr->id && $singleMstr->delete()) { return redirect()->route('masters.index'); } return back(); } }