Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

nicolasbeauvais/nova-algolia-card

Repository files navigation

Nova Algolia Cards

Latest Version on Packagist Total Downloads

Get some insight on your Algolia indexing with this easy to use Nova card.

nova-algolia-card

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require nicolasbeauvais/nova-algolia-card

Next up, you must register the card Nova. This is typically done in the tools method of the NovaServiceProvider.

// in app/Providers/NovaServiceProvider.php

// ...

public function cards()
{
    return [
        // ...
        new \NicolasBeauvais\NovaAlgoliaCard\NovaAlgoliaCard,
    ];
}

Config

If you are already using Laravel Scout everything is already configured.

If not, you must create a config/scout.php file with the following content:

<?php

return [
    'algolia' => [
        'id' => env('ALGOLIA_APP_ID', ''),
        'secret' => env('ALGOLIA_SECRET', ''),
    ],
];

Usage

By default the card will show the total number of records across all your Algolia indexes. You can specify an index name to the card to show it's number of records:

// in app/Nova/User.php

// ...

public function cards()
{
    return [
        new \NicolasBeauvais\NovaAlgoliaCard\NovaAlgoliaCard((new \App\User)->searchableAs()),
        // or
        new \NicolasBeauvais\NovaAlgoliaCard\NovaAlgoliaCard('my_user_index'),
    ];
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email nicolasbeauvais1@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.