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