app/Http/Controllers/ContactController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $request->validate([
            'name'=>'required',
            'address'=>'required',
            'phoneNumber'=>'required'
        ]);
        $contact = new Contact([
            'name'=>'required',
            'address'=>'required',
            'phoneNumber'=>'required'
        ]);
        $contact->save();
        return redirect('/contacts')->with('success', 'Contact saved!');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'name' => 'required' , 'address' => 'required' , 'phoneNumber' => 'required' ] ) ; $ contact = new Contact ( [ 'name' => 'required' , 'address' => 'required' , 'phoneNumber' => 'required' ] ) ; $ contact -> save ( ) ; return redirect ( '/contacts' ) -> with ( 'success' , 'Contact saved!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .