public function store(Request $request)
{
$data = $request->validate([
'image'=>'required|mimes:jpg,gif,png,jpeg',
'description' =>'required'
]);
$image = $request['image']->store('posts' ,'public');
$data['image'] = $image;
$data['slug'] = Str::random(10);
// Post::created($data); this one is valid as well as this one : auth()->user()->posts()->create($data)
auth()->user()->posts()->create($data);
return redirect()->back();
}