Initial commit: CABM-IT (ItGlue-style MSP documentation platform)

Laravel 13 + Livewire/Volt app for managing client organizations,
documents, passwords, flexible assets, virtual machines, contacts,
domains, todos, shortcuts, and role-based user administration.
This commit is contained in:
jeremy bayse
2026-08-16 13:28:12 +02:00
commit 8f22dca9c8
209 changed files with 23324 additions and 0 deletions
@@ -0,0 +1,64 @@
<?php
namespace Database\Seeders;
use App\Models\FlexibleAssetType;
use Illuminate\Database\Seeder;
class AssetTypeLookupSeeder extends Seeder
{
/**
* Ready-to-use asset types covering common IT inventory categories,
* with the fields a "Configuration" record used to carry.
*/
const TYPES = [
['name' => 'Poste de travail', 'icon' => '💻'],
['name' => 'Serveur', 'icon' => '🖧'],
['name' => 'Équipement réseau', 'icon' => '📡'],
['name' => 'Téléphone', 'icon' => '📱'],
['name' => 'NAS', 'icon' => '🗄️'],
['name' => 'Switch', 'icon' => '🔀'],
['name' => 'Wifi', 'icon' => '📶'],
['name' => 'Sauvegarde', 'icon' => '💾'],
['name' => 'Autre', 'icon' => '🔧'],
];
const FIELDS = [
['label' => 'Nom d\'hôte', 'field_type' => 'text', 'show_in_list' => true],
['label' => 'Adresse IP', 'field_type' => 'text', 'show_in_list' => true],
['label' => 'Adresse MAC', 'field_type' => 'text'],
['label' => 'Numéro de série', 'field_type' => 'text'],
['label' => 'Fabricant', 'field_type' => 'text'],
['label' => 'Modèle', 'field_type' => 'text'],
['label' => 'Système d\'exploitation', 'field_type' => 'text'],
['label' => 'Statut', 'field_type' => 'select', 'options' => ['choices' => ['Actif', 'Inactif', 'Retiré']], 'show_in_list' => true],
['label' => 'Site', 'field_type' => 'related_asset', 'options' => ['target' => 'location']],
['label' => 'Contact', 'field_type' => 'related_asset', 'options' => ['target' => 'contact']],
['label' => 'Date d\'installation', 'field_type' => 'date'],
['label' => 'Fin de garantie', 'field_type' => 'date'],
['label' => 'Notes', 'field_type' => 'textarea'],
];
public function run(): void
{
foreach (self::TYPES as $typeAttributes) {
$type = FlexibleAssetType::firstOrCreate(['name' => $typeAttributes['name']], $typeAttributes);
if ($type->fields()->exists()) {
continue;
}
foreach (self::FIELDS as $index => $field) {
$type->fields()->create([
'name' => \Illuminate\Support\Str::snake($field['label']),
'label' => $field['label'],
'field_type' => $field['field_type'],
'options' => $field['options'] ?? null,
'is_required' => false,
'show_in_list' => $field['show_in_list'] ?? false,
'sort_order' => $index,
]);
}
}
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
$this->call(RolesAndPermissionsSeeder::class);
$admin = User::factory()->create([
'name' => 'Administrateur',
'email' => 'administrateur@cabmit.local',
]);
$admin->assignRole('Administrateur');
$this->call(AssetTypeLookupSeeder::class);
}
}
@@ -0,0 +1,34 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
class RolesAndPermissionsSeeder extends Seeder
{
public function run(): void
{
$permissions = [
'manage-users',
'manage-asset-types',
'view-content',
'edit-content',
'delete-content',
];
foreach ($permissions as $permission) {
Permission::findOrCreate($permission);
}
$admin = Role::findOrCreate('Administrateur');
$admin->syncPermissions($permissions);
$technician = Role::findOrCreate('Technicien');
$technician->syncPermissions(['view-content', 'edit-content', 'delete-content']);
$readOnly = Role::findOrCreate('Lecture seule');
$readOnly->syncPermissions(['view-content']);
}
}