protected function saveCover(ArticleRequest $request, $article) { if (!$request->hasfile('cover')) { return $article->cover; } $file = $request->file('cover'); if (!$file->isValid()) { throw new Exception(trans('strings.image_not_invalid')); } $filename = $article->slug . '.' . $file->getClientOriginalExtension(); $file->move(public_path('images/covers'), $filename); return url('images/covers/' . $filename); }