app/Http/Controllers/EventController.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(EventStoreRequest $request)
    {
        $event = $request->user()->events()->save(new Event($request->only('title', 'event_date', 'about')));
        $imgFileName = $event->id . '.' . $request->file->getClientOriginalExtension();
        $filePath = 'eventFiles/' . $imgFileName;
        Storage::disk('s3')->put($filePath, file_get_contents($request->file));
        $event->file = $filePath;
        $event->save();
        return redirect()->route('events.index');
    }
public function store ( EventStoreRequest $ request ) { $ event = $ request -> user ( ) -> events ( ) -> save ( new Event ( $ request -> only ( 'title' , 'event_date' , 'about' ) ) ) ; $ imgFileName = $ event -> id . '.' . $ request -> file -> getClientOriginalExtension ( ) ; $ filePath = 'eventFiles/' . $ imgFileName ; Storage :: disk ( 's3' ) -> put ( $ filePath , file_get_contents ( $ request -> file ) ) ; $ event -> file = $ filePath ; $ event -> save ( ) ; return redirect ( ) -> route ( 'events.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .