Laravel

This is the official documentation of the forestadmin/laravel-forestadmin v2+ and forestadmin/symfony-forestadmin PHP agents.

Add forestadmin/laravel-forestadmin to your Laravel app

composer require forestadmin/laravel-forestadmin

Run the following commands in your terminal

php bin/console forest:install THE-KEY-PROVIDED-BY-FORESTADMIN

Once the installation is finish, you have a new configuration file (config/forest.php) and two environments variables in your .env

use ForestAdmin\AgentPHP\Agent\Builder\AgentFactory;
use ForestAdmin\AgentPHP\DatasourceEloquent\EloquentDatasource;

return static function () {
    $defaultDB = config('database.default');
    $forestAgent = app()->make(AgentFactory::class);
    $forestAgent->addDatasource(
        new EloquentDatasource(
            [
                'driver'   => config('database.connections.' . $defaultDB . '.driver'),
                'host'     => config('database.connections.' . $defaultDB . '.host'),
                'port'     => config('database.connections.' . $defaultDB . '.port'),
                'database' => config('database.connections.' . $defaultDB . '.database'),
                'username' => config('database.connections.' . $defaultDB . '.username'),
                'password' => config('database.connections.' . $defaultDB . '.password'),
                // OR
                // 'url' => config('database.connections.' . $defaultDB . '.url'),
            ]
        ),
    );
};

Running

php artisan serve

should be enough to be redirected to the "rate-install" page.

Last updated