app/Http/Controllers/ImagesController.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)
    {
        $base64_str = substr($request->image, strpos($request->image, ",")+1);
        $content = base64_decode($base64_str);
        $name = 'blog_'.time().'.jpg';
        Storage::disk('public')->put('images/'.$name, $content);
        $path="/public/images/$name";
        $Image=new Image();
        $Image->name=$name;
        $Image->article_id=$request->article_id;
        $Image->save();
        return view('admin.partials.image')->with('image',$Image);
    }
public function store ( Request $ request ) { $ base64_str = substr ( $ request -> image , strpos ( $ request -> image , " , " ) + 1 ) ; $ content = base64_decode ( $ base64_str ) ; $ name = 'blog_' . time ( ) . '.jpg' ; Storage :: disk ( 'public' ) -> put ( 'images/' . $ name , $ content ) ; $ path = " /public/images/ $ name " ; $ Image = new Image ( ) ; $ Image -> name = $ name ; $ Image -> article_id = $ request -> article_id ; $ Image -> save ( ) ; return view ( 'admin.partials.image' ) -> with ( 'image' , $ Image ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .