app/Http/Controllers/DependantController.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([
            'full_name'=>'required',
            'DOB'=>'required',
            'identification'=>'required',
            'relationship'=>'required',
        ]);
        auth()->user()->dependants()->create($request->all());
        return redirect()->route('dependant.show')->with('dependant_add','Dependant added successfully');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'full_name' => 'required' , 'DOB' => 'required' , 'identification' => 'required' , 'relationship' => 'required' , ] ) ; auth ( ) -> user ( ) -> dependants ( ) -> create ( $ request -> all ( ) ) ; return redirect ( ) -> route ( 'dependant.show' ) -> with ( 'dependant_add' , 'Dependant added successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .