ERROR
Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Call to a member function getClientOriginalExtension() on null"
Stacktrace:
0 Symfony\Component\Debug\Exception\FatalThrowableError in MYPATH\app\Http\Controllers\PostsController.php:66
Controller
public function store(Request $request)
{
$this->validate(request(),[
'title' => 'required',
'image' => 'image|mimes:jpeg,png,jpg,gif,svg',
'body' => 'required',
]);
$imageName = time().'.'.$request->image_file->getClientOriginalExtension();
$request->image->move(public_path('image'), $imageName);
auth()->user()->publish(
new Post(request(['title','body']))
);
session()->flash('message', 'your post has now been published');
return redirect('/');
}