This package contains various handy Artisan commands that you can use for management and maintenance.
# Complete installation with migrations and seeding
php artisan manta:install --with-migrations
# Seed default company (if none exist)
php artisan manta:seed-company
# Sync routes
php artisan manta:sync-routes --prefix=cms
# Import module settings from packages
php artisan manta:import-module-settings darvis/manta-contact
# Import upload module settings (required for upload functionality)
php artisan manta:import-module-settings darvis/manta-laravel-flux-cms --settings-file=export/settings-upload.php
# Create test user (local)
php artisan manta:create-user --email=test@example.com
# Create staff user (local)
php artisan manta:create-staff --email=admin@example.com
# Refresh package
php artisan manta:refresh
All commands use the manta:
prefix for consistency:
php artisan list manta
Synchronizes Laravel routes to the MantaRoute
table. This is useful for route-based navigation and permissions.
# Synchronize all routes
php artisan manta:sync-routes
# Only synchronize routes with a specific prefix (e.g. 'cms')
php artisan manta:sync-routes --prefix=cms
# Remove existing routes first and then synchronize
php artisan manta:sync-routes --clear
# Combination: only CMS routes with clear
php artisan manta:sync-routes --prefix=cms --clear
--prefix=PREFIX
: Filter routes by prefix--clear
: Remove existing routes before synchronizationThe command:
Route::getRoutes()
manta_routes
tableNote: First run the migration to create the manta_routes
table:
php artisan migrate
Imports module settings from any package into the MantaModule
model. This command allows you to import configuration and field definitions from different packages into the CMS system.
# Import settings from a package (default: export/settings.php)
php artisan manta:import-module-settings darvis/manta-contact
# Import with custom settings file path
php artisan manta:import-module-settings darvis/manta-contact --settings-file=config/module-settings.php
# Import all settings files from export directory
php artisan manta:import-module-settings darvis/manta-vacancy --all
# Force overwrite existing modules
php artisan manta:import-module-settings darvis/manta-contact --force
# Combine options: import all files and force overwrite
php artisan manta:import-module-settings darvis/manta-vacancy --all --force
package
: The package name (e.g., darvis/manta-contact
)--settings-file=PATH
: Relative path to settings file within package (default: export/settings.php
)--all
: Import all settings files from the export directory (pattern: settings*.php
)--force
: Overwrite existing module settingsThe command:
vendor/
directoryMantaModule
fields (1:1 mapping)name
is mandatory) and checks for existing modulesAll settings field names should match exactly with the MantaModule
database columns for seamless import.
The settings file should return an array where field names match exactly with MantaModule
database columns:
<?php
return [
// Required fields
"name" => "contact", // Unique module identifier
"title" => "Contact", // Display title
// Module name variations (optional)
"module_name" => [
"single" => "Contact", // Singular form
"multiple" => "Contacts" // Plural form
],
// Optional fields (with common defaults)
"description" => "Contact module", // Module description
"tabtitle" => "firstname", // Tab title field reference
"type" => "modules", // Module type
"active" => true, // Active status
"locale" => "nl", // Locale
"sort" => 999, // Sort order
// Navigation fields
"route" => null, // Route name
"url" => null, // Direct URL
"icon" => null, // Icon class/name
// Advanced fields
"rights" => null, // Access rights
"data" => [], // Additional data
// Module configuration (stored as JSON)
"ereg" => [
"tables" => [
// Database table definitions
]
],
"settings" => [
// Module-specific settings
],
"fields" => [
// Field definitions for forms
]
];
Available Fields:
All fields from the MantaModule
model are supported: name
, title
, module_name
, description
, tabtitle
, type
, active
, locale
, sort
, route
, url
, icon
, rights
, data
, ereg
, settings
, fields
, created_by
, updated_by
, deleted_by
, company_id
, host
.
Creates a staff user for testing purposes. Only works in the local environment (APP_ENV=local
).
# With default email (staff@example.com) and generated password
php artisan manta:create-staff
# With custom email
php artisan manta:create-staff --email=admin@yourdomain.com
# With custom email and password
php artisan manta:create-staff --email=admin@yourdomain.com --password=YourPassword
--email=EMAIL
: Email address for the staff user--password=PASSWORD
: Password (optional, otherwise a password is generated)Creates a regular user for testing purposes. Only works in the local environment (APP_ENV=local
).
# With automatically generated name, email and password
php artisan manta:create-user
# With custom name and email
php artisan manta:create-user --name="John Test" --email=user@example.com
# With custom name, email and password
php artisan manta:create-user --name="John Test" --email=user@example.com --password=SecurePassword123
--name=NAME
: Name for the user--email=EMAIL
: Email address for the user--password=PASSWORD
: Password (optional, otherwise a password is generated)Copies JavaScript libraries from the /libs
directory to the public/js/libs
directory.
# Copy libraries
php artisan manta:copy-libraries
# Overwrite files
php artisan manta:copy-libraries --force
--force
: Overwrite existing files in the public directory/libs
directory exists, if not, creates itpublic/js/libs
directory exists, if not, creates it/libs
to public/js/libs
Installs and configures the package for first use. This is the recommended way to set up the CMS as it handles all necessary steps automatically.
# Complete installation (recommended)
php artisan manta:install --with-migrations
# Basic installation without migrations
php artisan manta:install
# Force overwrite existing files
php artisan manta:install --with-migrations --force
--force
: Overwrite existing files--with-migrations
: Also publish and run migrations--skip-provider
: Skip registering the ServiceProvider--skip-provider
is used)--with-migrations
is used)Creates a default company and optionally generates additional sample companies. This is automatically called during manta:install
but can also be run manually to generate test data.
# Seed default company (if none exist)
php artisan manta:seed-company
# Generate 5 companies
php artisan manta:seed-company --count=5
# Generate 10 companies
php artisan manta:seed-company --count=10
--count=N
: Number of companies to generate (default: 1)The command:
--count
> 1Default company details:
Sample company data includes:
# When no companies exist (single company)
Running Company Seeder (generating 1 companies)...
âś“ Created 1 companies. Total companies in database: 1
📢 Default Company (COMP-001) - Amsterdam
# When generating multiple companies
Running Company Seeder (generating 5 companies)...
âś“ Created 5 companies. Total companies in database: 6
📢 Food & Beverage Co (COMP-002) - Utrecht
📢 Construction Masters (COMP-004) - Almere
📢 Consulting Group (COMP-006) - Amsterdam
📢 Construction Masters 1 (COMP-008) - Groningen
📢 Software Development (COMP-010) - Almere
# When companies already exist
âś“ Found 3 existing companies in database
đź’ˇ Use --count=5 to generate 5 additional companies anyway
Refreshes the package by clearing cache and rebuilding dependencies.
php artisan manta:refresh
# Without npm build
php artisan manta:refresh --no-build
--no-build
: Do not run npm run buildFor Manta modules, you can create seeders that follow a standardized pattern. This ensures consistency across all modules and provides users with familiar command options.
A proper Manta module seeder should:
Illuminate\Console\Command
Here’s how to create a seeder for a module like darvis/manta-page
:
<?php
namespace Darvis\MantaPage\Console\Commands;
use Darvis\MantaPage\Models\Page;
use Illuminate\Console\Command;
class SeedPageCommand extends Command
{
protected $signature = 'manta-page:seed
{--force : Force seeding even if pages already exist}
{--fresh : Delete existing pages before seeding}
{--with-navigation : Also seed navigation items for page management}';
protected $description = 'Seed the database with sample pages';
public function handle()
{
$this->info('🌱 Seeding Manta Pages...');
$this->newLine();
// Check existing items
$existingCount = Page::count();
if ($existingCount > 0 && !$this->option('force') && !$this->option('fresh')) {
$this->warn("⚠️ Found {$existingCount} existing pages.");
if (!$this->confirm('Do you want to continue seeding? This will add more items.', false)) {
$this->info('Seeding cancelled.');
return self::SUCCESS;
}
}
// Handle fresh option
if ($this->option('fresh')) {
if ($this->confirm('This will delete ALL existing pages. Are you sure?', false)) {
$this->info('🗑️ Deleting existing pages...');
Page::truncate();
$this->line(' âś… Existing pages deleted');
} else {
$this->info('Fresh seeding cancelled.');
return self::SUCCESS;
}
}
// Run the seeder
try {
$this->seedPageItems();
$totalCount = Page::count();
$this->newLine();
$this->info("🎉 Page seeding completed successfully!");
$this->line(" 📊 Total pages in database: {$totalCount}");
} catch (\Exception $e) {
$this->error('❌ Error during seeding: ' . $e->getMessage());
return self::FAILURE;
}
// Seed navigation if requested
if ($this->option('with-navigation')) {
$this->seedNavigation();
}
return self::SUCCESS;
}
private function seedPageItems(): void
{
// Your seeding logic here
}
private function seedNavigation(): void
{
// Navigation seeding logic here
}
}
Add the command to your module’s ServiceProvider:
// In your ModuleServiceProvider.php
if ($this->app->runningInConsole()) {
$this->commands([
\Darvis\MantaPage\Console\Commands\SeedPageCommand::class,
]);
}
All module seeders should support these options:
--force
: Force seeding even if items already exist--fresh
: Delete existing items before seeding (with confirmation)--with-navigation
: Also seed navigation items for module managementWhen seeding navigation items, use this structure:
private function seedModuleNavigation(): void
{
$navItems = [
[
'title' => 'Module Name',
'route' => 'module.list',
'sort' => 5, // Adjust as needed
'type' => 'module', // Important: use 'module', not 'content'
'description' => 'Manage module items'
]
];
$MantaNav = '\Manta\FluxCMS\Models\MantaNav';
foreach ($navItems as $item) {
$existingNav = $MantaNav::where('route', $item['route'])
->where('locale', 'nl')
->first();
if (!$existingNav) {
$MantaNav::create([
'created_by' => 'Module Seeder',
'company_id' => 1,
'host' => request()->getHost() ?? 'localhost',
'locale' => 'nl',
'active' => true,
'sort' => $item['sort'],
'title' => $item['title'],
'route' => $item['route'],
'type' => $item['type'],
'data' => json_encode([
'description' => $item['description'],
'icon' => 'document-text', // Choose appropriate icon
'module' => 'manta-module-name'
]),
]);
}
}
}
manta-{module}:seed
as command name'type' => 'module'
for navigation items# Test basic seeding
php artisan manta-module:seed
# Test with all options
php artisan manta-module:seed --fresh --force --with-navigation
# Check help
php artisan manta-module:seed --help