43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Bo;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Bo\Engagements\UpdateEngagementsRequest;
|
|
use App\Models\Engagement;
|
|
|
|
class EngagementsController extends Controller
|
|
{
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param Engagement $engagement
|
|
* @return \Illuminate\Contracts\View\View
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
|
*/
|
|
public function edit(Engagement $engagement): \Illuminate\Contracts\View\View
|
|
{
|
|
return view('back.engagements.edit', ['engagement' => $engagement]);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param UpdateEngagementsRequest $request
|
|
* @param Engagement $engagement
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
*/
|
|
public function update(
|
|
UpdateEngagementsRequest $request,
|
|
Engagement $engagement
|
|
): \Illuminate\Http\RedirectResponse {
|
|
$engagement->fill(array_replace_recursive(
|
|
\json_decode(\json_encode($engagement->toArray()), true),
|
|
$request->validated()
|
|
));
|
|
$engagement->saveOrFail();
|
|
return redirect()
|
|
->route('bo.engagements.edit', $engagement)
|
|
->with('success', 'Enregistré !');
|
|
}
|
|
}
|