Why Mosaic + Laravel?
Laravel is highly regarded for its versatility and efficiency, making it an ideal framework for building admin dashboards. By adding a Laravel version specifically for the Mosaic template, users can take advantage of Laravel’s robust features and capabilities to enhance the functionality of their admin dashboard.
To get a sense of what the Laravel version of Mosaic has to offer, we recommend checking out our free Lite version on Github.
Stack specifications
The Laravel version of Mosaic is a basic project built with Laravel Jetstream and Livewire + Blade. Jetstream simplifies the development process by providing pre-built authentication, registration, profile management, and more cool features, while Livewire + Blade allows for seamless integration of dynamic user interfaces without the need for additional JavaScript frameworks.
This eliminates the need for users to build these features from scratch, saving time and resources. Additionally, the template includes migration and seeder files for MySQL databases, making it easy to set up and manage data.
Quickstart
Setting up your .env config file
To ensure that your Laravel app is able to communicate with your database, it’s essential to add the necessary database configuration details, including the database name, username, password, and port, to your .env
file. These details will be used by Laravel to establish a connection to your database, allowing your app to perform, read, and write operations on the data stored in it.
Installing Laravel dependencies
Before you can start building your Laravel app, you need to install all of its required dependencies. To do this, simply navigate to the root directory of your Laravel application using your terminal, and run composer install
.
This command will download and install all the necessary packages and libraries that Laravel requires to function properly, including the framework itself, as well as any additional packages you may have specified in your composer.json
file.
Migrating tables
In order to create the necessary database tables and set up the basic structure required for your Laravel application, you’ll need to run the database migration command. To do this, open up your terminal and run php artisan migrate
.
Generating test data
Once you’ve set up your database tables, you can generate some test data using Laravel’s built-in database seeding functionality. To seed your database with pre-made data, run php artisan db:seed
in your terminal.
Please note that running this command multiple times will duplicate the test data in your database. To avoid this, you can truncate the tables listed below before running the command again:
campaign_marketer
campaigns
customers
datafeeds
invoices
jobs
marketers
members
orders
transactions
Compiling the Front-end
In order to compile all the CSS and JS assets for your Laravel application’s front-end, you need to install the necessary NPM dependencies. To do this, simply open your terminal, navigate to the root directory of your Laravel app, and run the command npm install
.
To re-compile your static assets whenever you make changes to your template, use the command npm run dev
in your terminal. This will compile your assets in development mode.
When you’re ready to finalize your changes and prepare your assets for production, run npm run build
in your terminal. This will compile and minify your assets for production use.
Launching the Laravel app
To launch your Laravel app on your local machine, navigate to the root directory and run php artisan serve
in your terminal. You’ll get a message that sounds something like Starting Laravel development server: http://127.0.0.1:8000. Just open the URL in your browser to start testing your new Mosaic Laravel app.