Я использую этот пакет
https://github.com/rtconner/laravel-tagging
но я не понимаю, как я поместил blog_id в этот пакет, я получаю эту ошибку
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'taggable_id' cannot be null (SQL: insert into `tagging_tagged` (`tag_name`, `tag_slug`, `taggable_type`, `taggable_id`) values (Gardening, gardening, App\blog, ))
Вот мой контроллер
public function blogstore(Request $request){
$this->validate($request, [
'title' => 'required|max:255|unique:blogs',
'summary' => 'required',
'description' => 'required',
'image' => 'image',
'agree' => 'required',
]);
$blog = new blog;
$blog->title = $request->title;
$blog->summary = $request->summary;
$blog->content = $request->description;
$blog->user_id = Auth::user()->id;
$blog->slug = EasySlug::generateSlug($blog->title, $separator = '-');
$blog->tag('Gardening'); //this is working tag name
$blog->tag(1); //trying to add blog_id
if($request->hasFile('image')) {
$file = Input::file('image');
//getting timestamp
$timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
$name = $timestamp. '-' .$file->getClientOriginalName();
$blog->image = $name;
$file->move(public_path().'/../public_html/img/blog/', $name);
$thumb = Image::make(public_path().'/../public_html/img/blog/' . $name)->resize(1366,786)->save(public_path().'/../public_html/img/blog/thumb/' . $name, 90);
}
$blog->save();
return redirect()->route('admin.blog.index')->with('status', 'Blog Posted Successfully');
}
Подробнее здесь: https://stackoverflow.com/questions/382 ... is-package
Как я поместил свой Blog_id в этот пакет ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как я могу настроить свой шаблон сетки после того, как я поместил область сетки в CSS?
Anonymous » » в форуме CSS - 0 Ответы
- 22 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Метод save(Iterable
) типа MongoRepositoryнеприменим для аргументов (Блог).
Anonymous » » в форуме JAVA - 0 Ответы
- 68 Просмотры
-
Последнее сообщение Anonymous
-