2022-08-05 09:38:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bo;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Http\Requests\StoreWhoareweKnowRequest;
|
|
|
|
|
use App\Models\WhoareweKnow;
|
2022-11-16 10:51:43 +01:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-08-05 09:38:44 +00:00
|
|
|
|
|
|
|
|
class WhoareweKnowsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Show the form for editing the specified resource.
|
|
|
|
|
*
|
|
|
|
|
* @param WhoareweKnow $whoareweknow
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
* @ignore phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
|
|
|
|
*/
|
|
|
|
|
public function edit(WhoareweKnow $whoareweknow): \Illuminate\Contracts\View\View
|
|
|
|
|
{
|
2022-11-10 10:50:57 +01:00
|
|
|
return view('back.whoarewe_knows.edit', compact('whoareweknow'));
|
2022-08-05 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
|
*
|
|
|
|
|
* @param StoreWhoareweKnowRequest $request
|
|
|
|
|
* @param WhoareweKnow $whoareweknow
|
|
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
|
|
* @ignore phpcs:disable Generic.Files.LineLength.TooLong
|
|
|
|
|
*/
|
|
|
|
|
public function update(StoreWhoareweKnowRequest $request, WhoareweKnow $whoareweknow): \Illuminate\Http\RedirectResponse
|
|
|
|
|
{
|
2022-11-16 10:51:43 +01:00
|
|
|
return DB::transaction(function () use ($request, $whoareweknow) {
|
|
|
|
|
$whoareweknow->fill($request->validated());
|
2022-08-05 09:38:44 +00:00
|
|
|
|
2022-11-16 10:51:43 +01:00
|
|
|
if ($whoareweknow->saveOrFail()) {
|
2026-10-27 15:12:56 +01:00
|
|
|
return to_route('bo.whoareweknows.edit', $whoareweknow->slug)
|
2022-11-16 10:51:43 +01:00
|
|
|
->with('success', trans(__('Changes_saved')));
|
|
|
|
|
}
|
2022-08-05 09:38:44 +00:00
|
|
|
|
2026-10-27 15:12:56 +01:00
|
|
|
return to_route('bo.whoareweknows.edit', $whoareweknow->slug)
|
2022-11-16 10:51:43 +01:00
|
|
|
->with('error', trans(__('Changes_failed')));
|
|
|
|
|
});
|
2022-08-05 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
}
|