app/Listeners/PortfolioFilesUploadEventListener.php
/**
     * Handle the event.
     *
     * @param  PortfolioFilesUploadEvent  $event
     * @return void
     */
Handle the event.
@param  PortfolioFilesUploadEvent  $event
@return void
Handle the event . @param PortfolioFilesUploadEvent $event @return void
public function handle(PortfolioFilesUploadEvent $event)
    {
        $path = storage_path() . '/app/' . $event->file;
        $filename = $event->file;
        if(Storage::disk('s3images')->getDriver()->put($filename, fopen($path, 'r+'), ['CacheControl'=>'max-age=2628000, must-revalidate'])){
            Storage::delete($filename);
        }
    }
public function handle ( PortfolioFilesUploadEvent $ event ) { $ path = storage_path ( ) . '/app/' . $ event -> file ; $ filename = $ event -> file ; if ( Storage :: disk ( 's3images' ) -> getDriver ( ) -> put ( $ filename , fopen ( $ path , 'r+' ) , [ 'CacheControl' => 'max-age=2628000, must-revalidate' ] ) ) { Storage :: delete ( $ filename ) ; } }
Handle the event.
Handle the event .
// Storage::disk('s3images')->delete($event->default); // $event->portfolio->thumbnail = $filename; // $event->portfolio->save(); // Delete file // return $filename;