app/Http/Controllers/Admin/BookController.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)
    {
        $post = $request->except('_token');
        if($request->hasFile('book_logo')){
            $post['book_logo'] = $this->upload('book_logo');
        }
        $res = Book::create($post);
        if($res){
            return redirect('/book');
        }
    }
public function store ( Request $ request ) { $ post = $ request -> except ( '_token' ) ; if ( $ request -> hasFile ( 'book_logo' ) ) { $ post [ 'book_logo' ] = $ this -> upload ( 'book_logo' ) ; } $ res = Book :: create ( $ post ) ; if ( $ res ) { return redirect ( '/book' ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
//dump($post);die; //文件上传