public function show (Article $article) {
return view('articles.show', compact('article'));
}
<a href="{{ url('/news', $article->slug) }}">{{ $article->title }}</a>
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your users. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'users' => 'users',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models users. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles users. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
'permissions' => 'permissions'
],
public function store(ArticleRequest $request)
{
if($request->hasFile('article_wall')) {
$image = $request->file('article_wall');
$imageName = time() . "." . $image->getClientOriginalExtension();
$savePath = public_path('/uploads/articleImages/' . $imageName);
Image::make($image)
->resize(320, 240)
->save($savePath);
//массив
$input = $request->all();
$input = array_except($input, 'pathName');
$input['article_wall'] = $imageName;
}
//сохранение статьи
echo "<pre>";
var_dump($input);
echo '</pre>';
Auth::user()->articles()
->create($input);
session()->flash('flash_message', 'Статья успешно создана');
return redirect('news');
}