$datastore_pccs]); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('datastore_pccs.create'); } /** * Store a newly created resource in storage. * * @param \App\Http\Requests\DatastorePccs\StoreDatastorePccRequest $request * @return \Illuminate\Http\Response */ public function store(StoreDatastorePccRequest $request) { $datastore_pcc = new DatastorePcc(); $datastore_pcc->fill($request->validated()); if ($datastore_pcc->saveOrFail()) { return redirect()->route('datastore_pccs.edit', compact('datastore_pcc')) ->with('success', trans('Datastore Pcc créé créé.')); } return \back(); } /** * Show the form for editing the specified resource. * * @param \App\Models\DatastorePcc $datastore_pcc * @return \Illuminate\Http\Response */ public function edit(DatastorePcc $datastore_pcc) { return view('datastore_pccs.edit', ['datastore_pcc' => $datastore_pcc]); } /** * Update the specified resource in storage. * * @param \App\Http\Requests\DatastorePccs\UpdateDatastorePccRequest $request * @param \App\Models\DatastorePcc $datastore_pcc * @return \Illuminate\Http\Response */ public function update(UpdateDatastorePccRequest $request, DatastorePcc $datastore_pcc) { $datastore_pcc->fill($request->validated()); if ($datastore_pcc->saveOrFail()) { return redirect()->route('datastore_pccs.edit', compact('datastore_pcc')) ->with('success', trans('Datastore Pcc mis à jour.')); } return \back(); } /** * Remove the specified resource from storage. * * @param \App\Models\DatastorePcc $datastore_pcc * @return \Illuminate\Http\Response */ public function destroy(DatastorePcc $datastore_pcc) { $isUsed = Server::where('datastore_pcc_id', '=', $datastore_pcc->id)->get(); if ($isUsed->count() === 0) { $isUsed = false; } return view('datastore_pccs.delete', compact('datastore_pcc', 'isUsed')); } /** * Remove the specified resource from storage. * * @param \App\Http\Requests\ValidateOtpRequest $request * @param \App\Models\DatastorePcc $datastore_pcc * @return \Illuminate\Http\Response * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed */ public function destroySubmit(ValidateOtpRequest $request, DatastorePcc $datastore_pcc) { // phpcs:enable if ($datastore_pcc->deleteOrFail()) { return redirect()->route('datastore_pccs.index') ->with('warning', 'Datastore Pcc supprimée !'); } return back(); } }