laravel - How to str_slug into model? -
search.blade.php
@foreach($search $item) <div class="post"> <a href="{{url($item["id"].'/'.$item["row_name"]).'.html'}}"> </div> @endforeach
searchcontroller.php
public function postsearch(searchrequest $request){ $search_key = $request->input('search'); $key_space = str_slug($search_key," "); $search = moives::where('row_name','like',"%$key_space%") ->orderby('id','desc') ->get(); if(count($search) > 0){ return view('user.pages.search',compact('search','search_key')); } else { return view ('user.pages.search')->withmessage('no details found. try search again !'); } }
url results:
http://lar.dev/blog/11609/beauty%20and%20the%20beast.html
but want results:
http://lar.dev/blog/11609/beauty-and-the-beast.html
the condition here can not add columns database, can retrieve data database.
in order divide words -
use str_slug
this:
str_slug($string,"-");
Comments
Post a Comment