Initial Commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'email_verified_at' => null,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('loaner_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('loaner_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('role_has_permission', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('role_id');
|
||||
$table->unsignedBigInteger('permission_id');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
|
||||
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
|
||||
$table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('role_has_permission');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('guid')->unique()->nullable();
|
||||
$table->string('domain')->nullable();
|
||||
$table->string('name');
|
||||
$table->string('username')->unique()->nullable();
|
||||
$table->string('password')->nullable();
|
||||
$table->rememberToken();
|
||||
|
||||
$table->unsignedBigInteger('loaner_type_id')->default(1);
|
||||
$table->unsignedBigInteger('role_id')->default(2);
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('loaner_type_id')->references('id')->on('loaner_types')->onDelete('cascade');
|
||||
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("name")->unique();
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('product_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('brands', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("name")->unique();
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('brands');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_models', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("name")->unique();
|
||||
$table->unsignedBigInteger('brand_id');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('brand_id')->references('id')->on('brands')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('product_models');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_subcategories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("name")->unique();
|
||||
$table->unsignedBigInteger('product_category_id');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('product_category_id')->references('id')->on('product_categories')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('product_subcategories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("barcode")->nullable();
|
||||
$table->string("name")->unique();
|
||||
$table->text("description")->nullable();
|
||||
|
||||
$table->unsignedBigInteger('brand_id');
|
||||
$table->unsignedBigInteger('product_model_id');
|
||||
$table->unsignedBigInteger('product_category_id');
|
||||
$table->unsignedBigInteger('product_subcategory_id')->nullable();
|
||||
$table->unsignedBigInteger('total')->default(0);
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('brand_id')->references('id')->on('brands')->onDelete('cascade');
|
||||
$table->foreign('product_model_id')->references('id')->on('product_models')->onDelete('cascade');
|
||||
$table->foreign('product_category_id')->references('id')->on('product_categories')->onDelete('cascade');
|
||||
$table->foreign('product_subcategory_id')->references('id')->on('product_subcategories')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('loan_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('loan_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cabel_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cabelcategories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cabels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->unsignedBigInteger('cabel_category_id');
|
||||
$table->unsignedBigInteger('total');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('cabel_category_id')->references('id')->on('cabel_categories')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cabels');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('buildings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('buildings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('rooms', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->unsignedBigInteger('building_id');
|
||||
$table->string('name');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('building_id')->references('id')->on('buildings')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('rooms');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('loans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->unsignedBigInteger('loan_type_id');
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('room_id')->nullable();
|
||||
|
||||
$table->morphs('loanable');
|
||||
|
||||
$table->date('date_start');
|
||||
$table->date('date_end')->nullable();
|
||||
$table->timestamp('date_deadline')->nullable();
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('room_id')->references('id')->on('rooms')->onDelete('cascade');
|
||||
$table->foreign('loan_type_id')->references('id')->on('loan_types')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('loans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('note_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('note_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('note_type_id');
|
||||
|
||||
$table->text('note');
|
||||
|
||||
$table->morphs('loanable');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('note_type_id')->references('id')->on('note_types')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('log_actions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('log_actions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('target_id')->nullable();
|
||||
$table->unsignedBigInteger('log_action_id');
|
||||
|
||||
$table->string('log')->nullable();
|
||||
|
||||
$table->morphs('loggable');
|
||||
|
||||
$table->unsignedBigInteger('amount')->nullable();
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('target_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('log_action_id')->references('id')->on('log_actions')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('contracts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->string('type');
|
||||
$table->unsignedBigInteger('timestamp');
|
||||
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('contracts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Brand;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BrandSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Dell'],
|
||||
['name' => 'HP'],
|
||||
['name' => 'AOC'],
|
||||
['name' => 'Samsung'],
|
||||
['name' => 'LG'],
|
||||
['name' => 'BenQ'],
|
||||
['name' => 'Acer'],
|
||||
['name' => 'Philips'],
|
||||
['name' => 'Speed Demon'],
|
||||
['name' => 'Chieftec'],
|
||||
['name' => 'Lenovo'],
|
||||
['name' => 'Fujitsu'],
|
||||
['name' => 'Atom'],
|
||||
['name' => 'Western Digital'],
|
||||
['name' => 'Logitech'],
|
||||
['name' => 'Brother'],
|
||||
['name' => 'Toshiba'],
|
||||
['name' => 'Microsoft'],
|
||||
['name' => 'Asus'],
|
||||
['name' => 'TRENDnet'],
|
||||
['name' => 'TP-Link'],
|
||||
['name' => 'Netgear'],
|
||||
['name' => 'Linksys'],
|
||||
['name' => 'Cisco'],
|
||||
['name' => 'Test Brand'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Brand::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Building;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BuildingSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Bygning 7'],
|
||||
['name' => 'Bygning 8'],
|
||||
['name' => 'Test Building'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Building::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\CabelCategory;
|
||||
use App\Models\ProductCategory;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CabelCategorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Netværk'],
|
||||
['name' => 'Skærm'],
|
||||
['name' => 'Adapters/Convertors'],
|
||||
['name' => 'Strøm'],
|
||||
['name' => 'USB'],
|
||||
['name' => 'Konsole'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
CabelCategory::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Cabel;
|
||||
use App\Models\CabelCategory;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CabelSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Netværk')->first()->id,
|
||||
'name' => '0-1m',
|
||||
'total' => 138,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Netværk')->first()->id,
|
||||
'name' => '1-2m',
|
||||
'total' => 32,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Netværk')->first()->id,
|
||||
'name' => '2-5m',
|
||||
'total' => 54,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Netværk')->first()->id,
|
||||
'name' => '5-10m',
|
||||
'total' => 32,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Skærm')->first()->id,
|
||||
'name' => 'DisplayPort',
|
||||
'total' => 13,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Skærm')->first()->id,
|
||||
'name' => 'VGA',
|
||||
'total' => 75,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Skærm')->first()->id,
|
||||
'name' => 'HDMI',
|
||||
'total' => 51,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Skærm')->first()->id,
|
||||
'name' => 'DVI',
|
||||
'total' => 71,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Skærm')->first()->id,
|
||||
'name' => 'DVI fuld',
|
||||
'total' => 70,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Adapters/Convertors')->first()->id,
|
||||
'name' => 'VGA til Mini HDMI',
|
||||
'total' => 1,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Adapters/Convertors')->first()->id,
|
||||
'name' => 'VGA til DVI',
|
||||
'total' => 1,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Adapters/Convertors')->first()->id,
|
||||
'name' => 'HDMI til DVI',
|
||||
'total' => 2,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Adapters/Convertors')->first()->id,
|
||||
'name' => 'Konsole USB til VGA Adaptor',
|
||||
'total' => 20,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Strøm')->first()->id,
|
||||
'name' => 'Strømkabler med jord',
|
||||
'total' => 191,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Strøm')->first()->id,
|
||||
'name' => 'Stikdåse ',
|
||||
'total' => 148,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','USB')->first()->id,
|
||||
'name' => 'USB-A til Mini-USB',
|
||||
'total' => 2,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','USB')->first()->id,
|
||||
'name' => 'USB-A til VGA 4 header',
|
||||
'total' => 1,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','USB')->first()->id,
|
||||
'name' => 'USB-A til DVI ',
|
||||
'total' => 1,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','USB')->first()->id,
|
||||
'name' => 'USB-A til USB-B',
|
||||
'total' => 11,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Konsole')->first()->id,
|
||||
'name' => 'Cisco Console til VGA',
|
||||
'total' => 44,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Konsole')->first()->id,
|
||||
'name' => 'Cisco USB til Mini-USB',
|
||||
'total' => 5,
|
||||
],
|
||||
[
|
||||
'cabel_category_id' => CabelCategory::where('name','=','Konsole')->first()->id,
|
||||
'name' => 'Cisco USB til Console',
|
||||
'total' => 23,
|
||||
],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Cabel::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// \App\Models\users::factory(10)->create();
|
||||
|
||||
// \App\Models\users::factory()->create([
|
||||
// 'name' => 'Test users',
|
||||
// 'email' => 'test@example.com',
|
||||
// ]);
|
||||
|
||||
$this->call([
|
||||
PermissionSeeder::class,
|
||||
RoleSeeder::class,
|
||||
LoanerTypeSeeder::class,
|
||||
UserSeeder::class,
|
||||
BuildingSeeder::class,
|
||||
RoomSeeder::class,
|
||||
BrandSeeder::class,
|
||||
ProductCategorySeeder::class,
|
||||
ProductSubcategorySeeder::class,
|
||||
ProductModelSeeder::class,
|
||||
ProductSeeder::class,
|
||||
LoanTypeSeeder::class,
|
||||
CabelCategorySeeder::class,
|
||||
CabelSeeder::class,
|
||||
NoteTypeSeeder::class,
|
||||
NoteSeeder::class,
|
||||
LogActionSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\LoanerType;
|
||||
use App\Models\LoanType;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LoanTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Loan'],
|
||||
['name' => 'Reservation - Awaiting'],
|
||||
['name' => 'Reservation - Set Up'],
|
||||
['name' => 'Reservation - Pick Up'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
LoanType::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\LoanerType;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LoanerTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'adUser'],
|
||||
['name' => 'nadUser'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
LoanerType::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\LogAction;
|
||||
use App\Models\NoteType;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LogActionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'created'],
|
||||
['name' => 'edited'],
|
||||
['name' => 'deleted'],
|
||||
['name' => 'restored'],
|
||||
['name' => 'force_deleted'],
|
||||
['name' => 'lent'],
|
||||
['name' => 'adjusted'],
|
||||
['name' => 'returned'],
|
||||
['name' => 'note'],
|
||||
['name' => 'reserved'],
|
||||
['name' => 'cancelled'],
|
||||
['name' => 'validated'],
|
||||
['name' => 'set up'],
|
||||
['name' => 'picked up'],
|
||||
['name' => 'amount_added'],
|
||||
['name' => 'amount_removed'],
|
||||
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
LogAction::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class NoteSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\NoteType;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class NoteTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Beskadiget'],
|
||||
['name' => 'Mangler'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
NoteType::create($item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Permission;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'users_viewAny'],
|
||||
['name' => 'users_viewAny_deleted'],
|
||||
['name' => 'users_view'],
|
||||
['name' => 'users_create'],
|
||||
['name' => 'users_edit'],
|
||||
['name' => 'users_edit_role'],
|
||||
['name' => 'users_edit_username'],
|
||||
['name' => 'users_delete'],
|
||||
['name' => 'users_delete_force'],
|
||||
['name' => 'users_restore'],
|
||||
['name' => 'buildings_viewAny'],
|
||||
['name' => 'buildings_viewAny_deleted'],
|
||||
['name' => 'buildings_view'],
|
||||
['name' => 'buildings_create'],
|
||||
['name' => 'buildings_edit'],
|
||||
['name' => 'buildings_delete'],
|
||||
['name' => 'buildings_delete_force'],
|
||||
['name' => 'buildings_restore'],
|
||||
['name' => 'rooms_viewAny'],
|
||||
['name' => 'rooms_viewAny_deleted'],
|
||||
['name' => 'rooms_view'],
|
||||
['name' => 'rooms_create'],
|
||||
['name' => 'rooms_edit'],
|
||||
['name' => 'rooms_delete'],
|
||||
['name' => 'rooms_delete_force'],
|
||||
['name' => 'rooms_restore'],
|
||||
['name' => 'roles_viewAny'],
|
||||
['name' => 'roles_viewAny_deleted'],
|
||||
['name' => 'roles_view'],
|
||||
['name' => 'roles_create'],
|
||||
['name' => 'roles_edit'],
|
||||
['name' => 'roles_edit_permissions'],
|
||||
['name' => 'roles_delete'],
|
||||
['name' => 'roles_delete_force'],
|
||||
['name' => 'roles_restore'],
|
||||
['name' => 'roles_permission'],
|
||||
['name' => 'brands_viewAny'],
|
||||
['name' => 'brands_viewAny_deleted'],
|
||||
['name' => 'brands_view'],
|
||||
['name' => 'brands_create'],
|
||||
['name' => 'brands_edit'],
|
||||
['name' => 'brands_delete'],
|
||||
['name' => 'brands_delete_force'],
|
||||
['name' => 'brands_restore'],
|
||||
['name' => 'models_viewAny'],
|
||||
['name' => 'models_viewAny_deleted'],
|
||||
['name' => 'models_view'],
|
||||
['name' => 'models_create'],
|
||||
['name' => 'models_edit'],
|
||||
['name' => 'models_delete'],
|
||||
['name' => 'models_delete_force'],
|
||||
['name' => 'models_restore'],
|
||||
['name' => 'categories_viewAny'],
|
||||
['name' => 'categories_viewAny_deleted'],
|
||||
['name' => 'categories_view'],
|
||||
['name' => 'categories_create'],
|
||||
['name' => 'categories_edit'],
|
||||
['name' => 'categories_delete'],
|
||||
['name' => 'categories_delete_force'],
|
||||
['name' => 'categories_restore'],
|
||||
['name' => 'subcategories_viewAny'],
|
||||
['name' => 'subcategories_viewAny_deleted'],
|
||||
['name' => 'subcategories_view'],
|
||||
['name' => 'subcategories_create'],
|
||||
['name' => 'subcategories_edit'],
|
||||
['name' => 'subcategories_delete'],
|
||||
['name' => 'subcategories_delete_force'],
|
||||
['name' => 'subcategories_restore'],
|
||||
['name' => 'products_viewAny'],
|
||||
['name' => 'products_viewAny_deleted'],
|
||||
['name' => 'products_view'],
|
||||
['name' => 'products_create'],
|
||||
['name' => 'products_edit'],
|
||||
['name' => 'products_delete'],
|
||||
['name' => 'products_delete_force'],
|
||||
['name' => 'products_restore'],
|
||||
['name' => 'products_amount_add'],
|
||||
['name' => 'products_amount_remove'],
|
||||
['name' => 'pdf_viewAny'],
|
||||
['name' => 'pdf_view'],
|
||||
['name' => 'pdf_delete'],
|
||||
['name' => 'cabels_viewAny'],
|
||||
['name' => 'cabels_viewAny_deleted'],
|
||||
['name' => 'cabels_view'],
|
||||
['name' => 'cabels_create'],
|
||||
['name' => 'cabels_edit'],
|
||||
['name' => 'cabels_delete'],
|
||||
['name' => 'cabels_delete_force'],
|
||||
['name' => 'cabels_restore'],
|
||||
['name' => 'cabels_amount_add'],
|
||||
['name' => 'cabels_amount_remove'],
|
||||
['name' => 'cabelCategories_viewAny'],
|
||||
['name' => 'cabelCategories_viewAny_deleted'],
|
||||
['name' => 'cabelCategories_view'],
|
||||
['name' => 'cabelCategories_create'],
|
||||
['name' => 'cabelCategories_edit'],
|
||||
['name' => 'cabelCategories_delete'],
|
||||
['name' => 'cabelCategories_delete_force'],
|
||||
['name' => 'cabelCategories_restore'],
|
||||
['name' => 'cabelCategories_amount_add'],
|
||||
['name' => 'cabelCategories_amount_remove'],
|
||||
['name' => 'logs_viewAny'],
|
||||
['name' => 'statistics'],
|
||||
['name' => 'loans_viewAny'],
|
||||
['name' => 'loans_create_user'],
|
||||
['name' => 'loans_create_laptop'],
|
||||
['name' => 'loans_adjust'],
|
||||
['name' => 'loans_return'],
|
||||
['name' => 'reservations_viewAny'],
|
||||
['name' => 'reservations_create'],
|
||||
['name' => 'reservations_validate'],
|
||||
['name' => 'reservations_cancel'],
|
||||
['name' => 'reservations_setup'],
|
||||
['name' => 'reservations_pickup'],
|
||||
['name' => 'reservations_return'],
|
||||
['name' => 'reservations_adjust'],
|
||||
['name' => 'notes_viewAny'],
|
||||
['name' => 'notes_viewAny_deleted'],
|
||||
['name' => 'notes_view'],
|
||||
['name' => 'notes_create'],
|
||||
['name' => 'notes_edit'],
|
||||
['name' => 'notes_delete'],
|
||||
['name' => 'notes_delete_force'],
|
||||
['name' => 'notes_restore'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Permission::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ProductCategory;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductCategorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Adapter'],
|
||||
['name' => 'Andet'],
|
||||
['name' => 'Laptop'],
|
||||
['name' => 'Bog'],
|
||||
['name' => 'El'],
|
||||
['name' => 'Enhed'],
|
||||
['name' => 'Hardware'],
|
||||
['name' => 'I/O Device'],
|
||||
['name' => 'Network'],
|
||||
['name' => 'Skærm'],
|
||||
['name' => 'Software'],
|
||||
['name' => 'Kit'],
|
||||
['name' => 'Printer'],
|
||||
['name' => 'Stationær'],
|
||||
['name' => 'Docking Station'],
|
||||
['name' => 'Server'],
|
||||
['name' => 'Tablet'],
|
||||
['name' => 'Værktøj'],
|
||||
['name' => 'Tilbehør'],
|
||||
['name' => 'Hub'],
|
||||
['name' => 'RobotArm - Tinker Kit'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
ProductCategory::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Brand;
|
||||
use App\Models\ProductModel;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductModelSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['brand_id' => Brand::where('name','=','Test Brand')->first()->id,'name' => 'Test Model'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
ProductModel::create($item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Brand;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductModel;
|
||||
use App\Models\ProductSubcategory;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
[
|
||||
'product_category_id' => ProductCategory::where('name','=','Laptop')->first()->id,
|
||||
'product_subcategory_id' => ProductSubcategory::where('name','=','Server Rum')->first()->id,
|
||||
'brand_id' => Brand::where('name','=','Test Brand')->first()->id,
|
||||
'product_model_id' => ProductModel::where('name','=','Test Model')->first()->id,
|
||||
'name' => 'Test Product',
|
||||
'description' => "Test Description",
|
||||
'total' => 100,
|
||||
'barcode' => "Test.Product.0001",
|
||||
],
|
||||
[
|
||||
'product_category_id' => ProductCategory::where('name','=','Laptop')->first()->id,
|
||||
'brand_id' => Brand::where('name','=','Test Brand')->first()->id,
|
||||
'product_model_id' => ProductModel::where('name','=','Test Model')->first()->id,
|
||||
'name' => 'Test Product 2',
|
||||
'description' => "Test Description 2",
|
||||
'total' => 100,
|
||||
'barcode' => "Test.Product.0002",
|
||||
],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Product::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductSubcategory;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductSubcategorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['product_category_id' => ProductCategory::where('name','=','Laptop')->first()->id,'name' => 'Server Rum'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
ProductSubcategory::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['name' => 'Administrator'],
|
||||
['name' => 'Elev'],
|
||||
['name' => 'Underviser'],
|
||||
['name' => 'Helpdesk'],
|
||||
['name' => 'Server'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Role::create($item);
|
||||
}
|
||||
|
||||
Role::where('name', '=', 'Administrator')->first()->permissions()->sync(Permission::all());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Building;
|
||||
use App\Models\Room;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RoomSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$items = [
|
||||
['building_id' => Building::where('name','=','Bygning 7')->first()->id,'name' => '7X1'],
|
||||
['building_id' => Building::where('name','=','Bygning 8')->first()->id,'name' => '8X1'],
|
||||
];
|
||||
foreach ($items as $item) {
|
||||
Room::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\LoanerType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
User::firstOrCreate([
|
||||
'name' => "Danny Johansson",
|
||||
'username' => 'dann4624',
|
||||
'guid' => '5e5417ed-d489-4376-a2d3-c263e70fe15e',
|
||||
'domain' => 'default',
|
||||
'password' => Hash::make('Nimai!1159'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'adUser')->id,
|
||||
'role_id' => 1
|
||||
]);
|
||||
|
||||
User::firstOrCreate([
|
||||
'name' => "Ynnad Nossnahoj",
|
||||
'username' => 'dann4625',
|
||||
'password' => Hash::make('Nimai!1159'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'nadUser')->id,
|
||||
'role_id' => 1
|
||||
]);
|
||||
|
||||
User::firstOrCreate([
|
||||
'name' => "Demo Admin",
|
||||
'username' => 'demo_admin',
|
||||
'password' => Hash::make('Pass1234'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'nadUser')->id,
|
||||
'role_id' => 1
|
||||
]);
|
||||
|
||||
User::firstOrCreate([
|
||||
'name' => "Demo Student",
|
||||
'username' => 'demo_student',
|
||||
'password' => Hash::make('Pass1234'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'nadUser')->id,
|
||||
'role_id' => 2
|
||||
]);
|
||||
|
||||
User::firstOrCreate([
|
||||
'name' => "Demo Teacher",
|
||||
'username' => 'demo_teacher',
|
||||
'password' => Hash::make('Pass1234'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'nadUser')->id,
|
||||
'role_id' => 3
|
||||
]);
|
||||
|
||||
User::firstOrCreate([
|
||||
'name' => "Demo Helper",
|
||||
'username' => 'demo_helper',
|
||||
'password' => Hash::make('Pass1234'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'nadUser')->id,
|
||||
'role_id' => 4
|
||||
]);
|
||||
|
||||
User::firstOrCreate([
|
||||
'name' => "Demo Server",
|
||||
'username' => 'demo_server',
|
||||
'password' => Hash::make('Pass1234'),
|
||||
'loaner_type_id' => LoanerType::all()->firstWhere('name','=', 'nadUser')->id,
|
||||
'role_id' => 5
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user