1 month ago

I need your help on this

Posted 1 month ago by snipesnipes

I got a controller that makes a query for my blog , see people can click on a category like CSS and then only the css articles will appear, but if someone mess up with the url such as CSSfhjsdfhk then an error appear of course but I want it to be a 404 not found .. how can I do this ?

I tried the findOrFail but it doesnt apply here as I am not searching for an id but a categorie name, I also tried the if (!$categories) { abort (404); } but no it doesnt work ..

public function showcategories($urlcategorie) {

    $categories = Blog::latest('blog_Id')->where('urlcategorie' , $urlcategorie)->Paginate(6);

    return view...


Please sign in or create an account to participate in this conversation.