Does it store the slug in the database or is the slug field null?
Mar 1, 2022
25
Level 5
Slug not working
I am storing the blog as follows :
controller :
Blog::insert([
'category_id' => $request->categoryid,
'post_title' => $request->post_title,
'slug' => Str::slug($request->post_title, '-'),
'post_image' => $save_url,
'post_details' => $request->post_details,
'created_at' => Carbon::now(),
blade
<a href="{{ route('post.details',[$item->id, $item->slug]) }}" class="blog-post">
But strangely first few blogs were working with slug, but now new blogs are not working ?
Level 102
I think I just spotted the error. You are using the same ID for looking up both blog and category?
Blog::findOrFail($id);
BlogCategory::findOrFail($id);
1 like
Please or to participate in this conversation.