app/Http/Controllers/SliderController.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)
    {
        $file = $request->file('image');
        $extension = $file->getClientOriginalExtension();
        $filename = 'images/sliders/' . time() . '.' . $extension;
        $file->move('public/images/sliders', $filename);
        $sliders = new Slider([
            'title' => $request->get('title'),
            'image' => $filename,
            'type' => $request->get('type'),
            'expires_on' => $request->get('expires_on'),
            'status' => $request->get('status'),
        ]);
        if ($sliders->save())
            return back()->with('successMsg', 'slider created successfully');
    }
public function store ( Request $ request ) { $ file = $ request -> file ( 'image' ) ; $ extension = $ file -> getClientOriginalExtension ( ) ; $ filename = 'images/sliders/' . time ( ) . '.' . $ extension ; $ file -> move ( 'public/images/sliders' , $ filename ) ; $ sliders = new Slider ( [ 'title' => $ request -> get ( 'title' ) , 'image' => $ filename , 'type' => $ request -> get ( 'type' ) , 'expires_on' => $ request -> get ( 'expires_on' ) , 'status' => $ request -> get ( 'status' ) , ] ) ; if ( $ sliders -> save ( ) ) return back ( ) -> with ( 'successMsg' , 'slider created successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .