mardi 16 août 2016

How to make Highlight for search results by Laravel 5.2?

in view:

@if($posts)
            @foreach($posts as$post)
                <h2>
                    <a href=""></a>
                </h2>
                <p class="lead">
                    by <a href="index.php"></a>
                </p>
                <p><span class="glyphicon glyphicon-time"></span> Posted </p>
                <hr>
                <img class="img-responsive" src="" alt="">
                <hr>
                {!! str_limit($post->body,35 )!!}
                <a class="btn btn-primary" href="">Read More <span class="glyphicon glyphicon-chevron-right"></span></a>
                <hr>
            @endforeach
        @endif

in controller:

public function searchmulti(){
        $keyword=Input::get('title');
        $posts = Post::where('title', 'like', "%$keyword%")->get();
        return view('Admin.comments.postsauthor',compact('posts'));
       }

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire