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(StudentRequest $request)
    {
        $data = $request->all();
        $data['foto'] = $request->file('foto')->store('assets/students','public');
        $data['user_id'] = $request->user()->id;
        $data['nilai_total'] = 0;
        Student::create($data);
        return redirect()->route('home');
    }
public function store ( StudentRequest $ request ) { $ data = $ request -> all ( ) ; $ data [ 'foto' ] = $ request -> file ( 'foto' ) -> store ( 'assets/students' , 'public' ) ; $ data [ 'user_id' ] = $ request -> user ( ) -> id ; $ data [ 'nilai_total' ] = 0 ; Student :: create ( $ data ) ; return redirect ( ) -> route ( 'home' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .