Merge
This commit is contained in:
@@ -13,6 +13,9 @@ class CreateUsersTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if(Schema::hasTable("users"))
|
||||
return;
|
||||
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_first');
|
||||
|
||||
@@ -20,13 +20,17 @@ class CreatePermissionTables extends Migration
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('description');
|
||||
$table->string('guard_name');
|
||||
$table->timestamps();
|
||||
});
|
||||
if(!Schema::hasTable("permissions"))
|
||||
{
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('description');
|
||||
$table->string('guard_name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateStaffTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('staff', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_first');
|
||||
$table->string('name_last');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->integer("phone")->unique();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('staff');
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGalleryAlbum extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('gallery_album', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('gallery_album');
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGalleryVideo extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('gallery_video', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('gallery_video');
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGalleryImage extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('gallery_image', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('gallery_image');
|
||||
}
|
||||
}
|
||||
@@ -12,5 +12,6 @@ class DatabaseSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$this->call(PermissionSeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,19 +40,29 @@ class PermissionSeeder extends Seeder
|
||||
"link.external.edit" => "Allows editing of external links.",
|
||||
"link.external.delete" => "Allows deletion of external links",
|
||||
|
||||
"event.create" => "Create a new event",
|
||||
"event.list" => "Shows all events",
|
||||
"event.show" => "Shows event",
|
||||
"event.edit" => "Edit event",
|
||||
"event.delete" => "Deletes an event",
|
||||
|
||||
"contact.create" => "Creates a new contact",
|
||||
"contact.list" => ""
|
||||
];
|
||||
|
||||
foreach ($permissions as $key => $value) {
|
||||
if(Permission::findByName($key))
|
||||
continue;
|
||||
|
||||
$permission = new Permission();
|
||||
try {
|
||||
if(Permission::findByName($key))
|
||||
continue;
|
||||
} catch (Exception $e) {
|
||||
$permission = new Permission();
|
||||
|
||||
$permission->name = $key;
|
||||
$permission->description = $value;
|
||||
$permission->name = $key;
|
||||
$permission->description = $value;
|
||||
|
||||
$permission->save();
|
||||
$permission->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user