47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Bo;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\StoreWhoareweExpertiseDetailRequest;
|
|
use App\Models\WhoareweExpertiseDetail;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class WhoareweExpertiseDetailsController extends Controller
|
|
{
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param WhoareweExpertiseDetail $whoareweexpertisedetail
|
|
* @return \Illuminate\Contracts\View\View
|
|
* @ignore phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
|
*/
|
|
public function edit(WhoareweExpertiseDetail $whoareweexpertisedetail): \Illuminate\Contracts\View\View
|
|
{
|
|
return view('back.whoarewe_expertise_details.edit', compact('whoareweexpertisedetail'));
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param StoreWhoareweExpertiseDetailRequest $request
|
|
* @param WhoareweExpertiseDetail $whoareweexpertisedetail
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
*/
|
|
public function update(
|
|
StoreWhoareweExpertiseDetailRequest $request,
|
|
WhoareweExpertiseDetail $whoareweexpertisedetail
|
|
): \Illuminate\Http\RedirectResponse {
|
|
return DB::transaction(function () use ($request, $whoareweexpertisedetail) {
|
|
$whoareweexpertisedetail->fill($request->validated());
|
|
|
|
if ($whoareweexpertisedetail->saveOrFail()) {
|
|
return to_route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
|
|
->with('success', trans(__('Changes_saved')));
|
|
}
|
|
|
|
return to_route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
|
|
->with('error', trans(__('Changes_failed')));
|
|
});
|
|
}
|
|
}
|