Add Uccello to a Laravel project

It is possible to add Uccello to an existing Laravel project (version >= 5.6).

1. Install the Uccello library

You can install the uccello/uccello dependency with composer.

composer require uccello/uccello

If you are using a version of Laravel lower than 5.5, you will need to add the following code in the config/app.php file:

'providers' => [
    ...
    /*
     * Package Service Providers...
     */
    Uccello\Core\Providers\AppServiceProvider::class,
    Uccello\Core\Providers\RouteServiceProvider::class,
    ...
],
...
'aliases' => [
    ...
    'Uccello' => Uccello\Core\Facades\Uccello::class,
],

Then execute the following command to extract all the files necessary for Uccello to work properly:

2. Add the middlewares

Open the file app/Http/Kernel.php and add the following code to add the middlewares used by Uccello :

3. Configure the routes

Add the following code to the routes/web.php file to automatically generate the route for to access Uccello.

This automatically detects whether the notion of multi domains is used or not and redirects the user to the last domain he visited.

If you want to access Uccello from your home page, just replace Route::get('/uccello', ...) by Route::get('/', ...)

4. Configure the environment

Once the project is created you can configure the .env file as explained in Laravel's official documentation.

If you do not want to use the notion of multi domains, you can add the following line into the .env file:

5. Execute migrations

Once the database is configured, it is now possible to execute migrations to create the database structure used by Uccello.

6. Create an user

To easily create a new user, execute the following command:

7. Activate connection log

You can see last connections of a user in his detail page. To activate this functionality edit the file located at app/Http/Controllers/Auth/LoginController.php and the following code:

8. It's ready!

If you would like to use PHP's built-in development server to serve your application, this command will start a local development server:

Now you can go to the home page of your site: http://localhost:8000. Once redirected to the login page, you can authenticate yourself with the credentials created at the step 6.

Last updated

Was this helpful?