I get this error:
Symfony\Component\Debug\Exception\FatalThrowableError (E_ERROR) Call to undefined method Illuminate\Auth\AuthManager::user()
Code in ImageGalleryController
{
$this->validate($request, [
'title' => 'required',
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
$input['image'] = time().'.'.$request->image->getClientOriginalExtension();
$request->image->move(public_path('images'), $input['image']);
$input['title'] = $request->title;
$input['uid'] = Auth()::user()->id;
ImageGallery::create($input);
return back()
->with('success','Image Uploaded successfully.');
}
/**
* Remove Image function
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
ImageGallery::find($id)->delete();
return back()
}
ImageGalleryController
is not precise. It looks like you forgot the part before (I don't see the method signature) and the part after (I don't see any closing bracket). Can you complete it? – louisfischer