Sometimes in development, you want to quickly get such a lightweight tool for creating a web application of any complexity with building your own architecture completely without having to spend time preparing its admin part. That is, so to speak, to get such a simple framework, without a pile of any junk there, where the user part and the administrative part are allocated.
There is a fairly flexible, free and simple solution for all this, like Voyager.
Voyager is a Laravel package that provides a complete and flexible framework administration system.
On this Laravel framework, together with Voyager, you can create whatever you want if you understand the basic principle of Laravel and its MVC architecture.
Instructions for installing Voyager on Laravel
Step 1: Install Voyager
Open a terminal and navigate to your Laravel project directory.
cd path/to/your/laravel/project
Then run the following command:
composer require tcg/voyager
This will add Voyager and all its dependencies to your Laravel project.
Step 2: Publishing Voyager Resources
After installation, run the command:
php artisan voyager:install
This command will create the necessary tables in the database and publish the configuration files and artifacts necessary for Voyager to work.
Step 3: Create an Administrator
Create an administrator account by running the command:
php artisan voyager:admin your_email@example.com --create
Replace your_email@example.com
to your email address. You will need to enter the password for the account you are creating.
Make sure you remember these credentials, as you will need them to log in to the admin area.
Step 4: Proceed to creating siders
Now that Voyager is installed, you can create siders to populate the database.
4.1 Creating a seeder
Create a seeder by running the command:
php artisan make:seeder YourTableSeeder
Replace YourTableSeeder
with the name of your seeder. This will create a seeder file in the database/seeds
directory.
4.2 Filling the sider with data
Open the created seeder file and add the data:
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\DataType;
use TCG\Voyager\Models\Bread;
class YourTableSeeder extends Seeder
{
public function run()
{
// Example of adding a new Bread record
Bread::create([
'name' => 'your_table_name',
'display_name_singular' => 'Your Table',
'display_name_plural' => 'Your Tables',
// add other required fields
]);
// Example of creating records for a specific table
DB::table('your_table_name')->insert([
['column1' => 'value1', 'column2' => 'value2'],
['column1' => 'value3', 'column2' => 'value4'],
// add other entries
]);
}
}
4.3 Sider registration
Register your sider in database/seeders/DatabaseSeeder.php
:
public function run()
{
$this->call(YourTableSeeder::class);
}
Step 5: Launch the siders
After creating the seeders, run the command to run them:
php artisan db:seed
This command will populate your database with the data specified in the seeders.
Step 6: Starting the server
Start the local server to check:
php artisan serve
Open the address in the browserhttp://localhost:8000/admin
to log into the Voyager admin panel using previously created credentials.
Step 7: Configure Voyager
Now you can:
- Check the added entries in the administrative panel.
- Adjust settings or add new BREAD for other tables, if necessary.
- Work with users, roles, and permissions in Voyager.
This is how the Voyager administrative panel is installed on the Laravel framework.
Voyager provides powerful tools for managing data in your application.Additional information can be found in official Voyager documentation.