I am having trouble uploading my image into database, everytime I try to upload it, the data send into the database is empty but my local disk is able to store the image and I don't know what to do. I think I might have done something wrong in the controller part
Controller:
public function store1(Request $request){
$this->validate($request, [
'file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
if ($request->hasFile('file')) {
$image = $request->file('file');
$name = $image->getClientOriginalName();
$size = $image->getClientSize();
$destinationPath = public_path('/images');
$image->move($destinationPath, $name);
$userImage = new UserImage;
$userImage->name = $name;
$userImage->size = $size;
//dd($userImage);
$userImage->save;
}
table that I wanted to upload to:
Schema::create('user_images', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('size');
$table->integer('user_id');
$table->timestamps();
});