ldc-domaine-de-lanvaux/app/Http/Controllers/Bo/WhoareweIconDetailsController.php
Alexis Gousseau 4c39db12d7 Refonte
2022-08-05 09:38:44 +00:00

43 lines
1.6 KiB
PHP

<?php
namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreWhoareweIconDetailRequest;
use App\Models\WhoareweIconDetail;
class WhoareweIconDetailsController extends Controller
{
/**
* Show the form for editing the specified resource.
*
* @param WhoareweIconDetail $whoareweicondetail
* @return \Illuminate\Contracts\View\View
* @ignore phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
*/
public function edit(WhoareweIconDetail $whoareweicondetail): \Illuminate\Contracts\View\View
{
return view('bo.whoarewe_icon_details.edit', compact('whoareweicondetail'));
}
/**
* Update the specified resource in storage.
*
* @param StoreWhoareweIconDetailRequest $request
* @param WhoareweIconDetail $whoareweicondetail
* @return \Illuminate\Http\RedirectResponse
* @ignore phpcs:disable Generic.Files.LineLength.TooLong
*/
public function update(StoreWhoareweIconDetailRequest $request, WhoareweIconDetail $whoareweicondetail): \Illuminate\Http\RedirectResponse
{
$whoareweicondetail->fill($request->validated());
if (!$whoareweicondetail->saveOrFail()) {
return redirect()->route('bo.whoareweicondetails.edit', $whoareweicondetail->slug)
->with('error', trans(__('Modification_failed')));
}
return redirect()->route('bo.whoareweicondetails.edit', $whoareweicondetail->slug)
->with('success', trans(__('Changes_saved')));
}
}