ldc-domaine-de-lanvaux/app/Http/Controllers/Bo/WhoareweBrandDetailsController.php
2026-10-27 15:12:56 +01:00

46 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreWhoareweBrandDetailRequest;
use App\Models\WhoareweBrandDetail;
use Illuminate\Support\Facades\DB;
class WhoareweBrandDetailsController extends Controller
{
/**
* Show the form for editing the specified resource.
*
* @param WhoareweBrandDetail $whoarewebranddetail
* @return \Illuminate\Contracts\View\View
* @ignore phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
*/
public function edit(WhoareweBrandDetail $whoarewebranddetail): \Illuminate\Contracts\View\View
{
return view('back.whoarewe_brand_details.edit', compact('whoarewebranddetail'));
}
/**
* Update the specified resource in storage.
*
* @param StoreWhoareweBrandDetailRequest $request
* @param WhoareweBrandDetail $whoarewebranddetail
* @return \Illuminate\Http\RedirectResponse
* @ignore phpcs:disable Generic.Files.LineLength.TooLong
*/
public function update(StoreWhoareweBrandDetailRequest $request, WhoareweBrandDetail $whoarewebranddetail): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $whoarewebranddetail) {
$whoarewebranddetail->fill($request->validated());
if ($whoarewebranddetail->saveOrFail()) {
return to_route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
->with('error', trans(__('Changes_failed')));
});
}
}