Framework integration / Laravel / Getting started

Quick start

First, import your data into Algolia. To import your data, use the scout:import Artisan command:

$
php artisan scout:import

Next, open the routes/web.php file and add the following route to the bottom of the file:

1
2
3
4
5
6
7
Route::get('search', function() {
    $query = ''; // <-- Change the query for testing.

    $articles = App\Article::search($query)->get();

    return $articles;
});

Now, if you visit the /search route in your web browser, you should see all articles that match the given $query.

This is just the beginning. In this quick start, you’ve seen the basics, but there are much more exciting things to learn. Keep reading through the documentation and dig deeper into the powerful features available to you in Scout Extended.

Did you find this page helpful?