Grundgerüst Formulare und Seeder
This commit is contained in:
@@ -16,8 +16,9 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('type');
|
||||
$table->foreignIdFor(User::class, 'responsible');
|
||||
$table->morphs('contractable');
|
||||
$table->foreignIdFor(User::class, 'responsible_id');
|
||||
$table->integer('contractable_id')->nullable();
|
||||
$table->string('contractable_type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('documentpermissions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("type");
|
||||
$table->string("class");
|
||||
$table->string("acl");
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documentpermissions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contactgroups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contactgroups');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contactgroupables', function (Blueprint $table) {
|
||||
$table->foreignId('contactgroup_id')->constrained();
|
||||
$table->morphs('contactgroupable');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contactgroupables');
|
||||
}
|
||||
};
|
||||
28
database/seeders/ContactgroupSeeder.php
Normal file
28
database/seeders/ContactgroupSeeder.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Contactgroup;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ContactgroupSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$contactgroups = [
|
||||
'Personalabteilung',
|
||||
'Geschäftsführung',
|
||||
'Support',
|
||||
'Entwicklung',
|
||||
'Finanzen',
|
||||
];
|
||||
foreach ($contactgroups as $contactgroup) {
|
||||
Contactgroup::firstOrCreate(['name' => $contactgroup]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,15 @@ class DatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
|
||||
User::firstOrCreate(
|
||||
['email' => 'info@geoventis.de'],
|
||||
[
|
||||
'name' => 'Max Mustermann',
|
||||
'password' => bcrypt('servo3000'),
|
||||
]
|
||||
);
|
||||
$this->call([
|
||||
UserSeeder::class,
|
||||
DocumentpermissionSeeder::class,
|
||||
ContactgroupSeeder::class,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
22
database/seeders/DocumentpermissionSeeder.php
Normal file
22
database/seeders/DocumentpermissionSeeder.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DocumentpermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('documentpermissions')->insert([
|
||||
'type' => 'Krankmeldung',
|
||||
'class' => 'App\Models\User',
|
||||
'acl' => 'default:|self:cr|memberOf(contactgroups.Personalabteilung)',
|
||||
]);
|
||||
}
|
||||
}
|
||||
31
database/seeders/UserSeeder.php
Normal file
31
database/seeders/UserSeeder.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
User::firstOrCreate(
|
||||
['email' => 'info@geoventis.de'],
|
||||
[
|
||||
'name' => 'Max Mustermann',
|
||||
'password' => bcrypt('servo3000'),
|
||||
]
|
||||
);
|
||||
User::firstOrCreate(
|
||||
['email' => 'alexander.gabriel@digital-infinity.de'],
|
||||
[
|
||||
'name' => 'Alexander Gabriel',
|
||||
'password' => bcrypt('servo3000'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user