mardi 27 décembre 2016

Newbies trying to implement search in larvel

i am new to laraval5,i would like to create a simple search form in larval5 using the array . can you guys give me a solution for this problem.

here is my controller :

public function postSearch()

{

$q = array(title => 'blue', body => 'red');

$posts = $this->post->whereRaw(

"MATCH(title,body) AGAINST(? IN BOOLEAN MODE)",

array($q)

)->get();

return View::make('posts.index', compact('posts')); } here is my route : Route::post(

    'posts/search',

    array(

        'as' => 'posts.search',

        'uses' => 'aboutController@postSearch'

    )

);

view :



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire