app/Http/Controllers/StudentController.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)
    {
        $this->validate($request,[
            'name' => 'required|min:3',
            'mobile' => 'required',
            'address' => 'required'
        ]);
        $student = Student::create($request->all());
        return response()->json(['data'=>$student]);
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|min:3' , 'mobile' => 'required' , 'address' => 'required' ] ) ; $ student = Student :: create ( $ request -> all ( ) ) ; return response ( ) -> json ( [ 'data' => $ student ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .