How to Implement Scout Search In Bagisto

Updated 19 May 2023

Here we are going to implement a scout search in Bagisto. For this here are some of the steps which needed to be followed:-

Step 1: Create a custom package

You can create a package by following the create bagsito package link https://devdocs.bagisto.com/1.x/packages/create-package.html

Step 2: Create a menu in the Bagisto package

You can create a menu by following this link https://bagisto.com/en/how-to-add-menu-in-admin-panel-in-bagisto/

Step 3:  Install Scout

In this step, we have to install scout package and we will publish them:

Next, we have to publish our configuration file. so you need to run bellow command:

Now we need to set the configuration database as a driver in your .env file:

Step 4: Update the Model Which You Want

Here, We need to add use Laravel\Scout\Searchable in the namespace section and “Searchable” in the use section and create the toSearchableArray() method. so let’s update the following code:

Next, we will import it.

Step 5: Create a Controller In Your Package

Let’s update the following code to your controller file:

Step 6: Add Route

Step 6: Create a View

Run Laravel App:

All the required steps have been done, now you have to type the given below command and hit enter to run the Laravel app:

Now, Go to your web browser, type the given URL, and view the app output:

Output:

Thank you for reading my blog on how to implement scout search in Bagisto. If you have any queries you can free to contact me in the comment section.

Additionally, if you’re looking to hire Laravel developers, you can visit Webkul. For exploring the available extensions for Bagisto, you can check out extensions.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project




    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home