app/Http/Controllers/ContactController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Contact  $contact
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Contact $contact)
    {
        $this->authorize("update", Contact::class);
        request()->validate([
            "adresse"=>["required"],
            "phone"=>["required"],
            "email"=>["required"]
        ]);
        $contact->adresse = $request->adresse;
        $contact->phone = $request->phone;
        $contact->email = $request->email;
        $contact->save();
        return redirect('/');
    }
public function update ( Request $ request , Contact $ contact ) { $ this -> authorize ( " update " , Contact :: class ) ; request ( ) -> validate ( [ " adresse " => [ " required " ] , " phone " => [ " required " ] , " email " => [ " required " ] ] ) ; $ contact -> adresse = $ request -> adresse ; $ contact -> phone = $ request -> phone ; $ contact -> email = $ request -> email ; $ contact -> save ( ) ; return redirect ( '/' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .