Upload Multiple Images

HTML

<form name="upload_image_form" action="{{ BASE_URL }}event/image" method="POST">
	<input type="file" class="form-control" name="images[]" multiple>
	<input type="hidden" name="id" value="{{$event->id}}">
	<button type="submit" class="btn btn-secondary">新增圖片</button>
</form>

Laravel:

    public function upload_image(Request $req){
        $user = $this->guard()->user();

        $eid = $req->input('id');
        if($eid == false){
            return $this->fail_response('ID錯誤');
        }

        $event = EventM::find($eid);

        if($this->check_pms($event->pid) == false){
            return $this->fail_response('權限錯誤');
        }

        $allow_mime = ['image/png', 'image/jpg', 'image/gif', 'image/jpeg'];
        $event_images = json_decode($event->images);

        $images = $req->file('images');
        foreach($images as $key => $image){
            //logg($image->getSize()/1024/1024);//mb
            $mime = $image->getMimeType();
            if(in_array($mime, $allow_mime) == false){
                continue;
            }
            
            $path = $image->store('public/' . $user->id);
            $image = str_replace('public', '', $path);

            self::make_thumb($image);

            $event_images[] = $image;
        }

        $event->images = json_encode($event_images);
        $event->save();

        return $this->success_response($eid);
    }