app/Http/Controllers/Admin/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(StudentValidator $request)
    {
        if ($request->hasFile('image')) {
            $image = $request->file('image');
            $images = "image-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('images/student/', $images);
            }
            $student = new Student([
                'fname' => $request->fname,
                'lname' => $request->lname,
                'dob' => $request->dob,
                'gender' => $request->gender,
                'email'   => $request->email,
                'stdcat' => $request->stdcat,
                'phone' => $request->phone,
                'batch' => $request->batch,
                'section' => $request->section,
                'course' => $request->course,
                'address' => $request->address
            ]);
            $student->image = $images;
            $student->save();
        return redirect()->route('student.index')->with('success', 'Student Created successfully');
    }
public function store ( StudentValidator $ request ) { if ( $ request -> hasFile ( 'image' ) ) { $ image = $ request -> file ( 'image' ) ; $ images = " image- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/student/' , $ images ) ; } $ student = new Student ( [ 'fname' => $ request -> fname , 'lname' => $ request -> lname , 'dob' => $ request -> dob , 'gender' => $ request -> gender , 'email' => $ request -> email , 'stdcat' => $ request -> stdcat , 'phone' => $ request -> phone , 'batch' => $ request -> batch , 'section' => $ request -> section , 'course' => $ request -> course , 'address' => $ request -> address ] ) ; $ student -> image = $ images ; $ student -> save ( ) ; return redirect ( ) -> route ( 'student.index' ) -> with ( 'success' , 'Student Created successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .