v0.5.3 - Added Locations and a location_id to washing machines

This commit is contained in:
frederikpyt
2020-08-06 08:37:16 +02:00
parent 9b631843b0
commit 5452711665
22 changed files with 424 additions and 40 deletions
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLocationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('locations', function (Blueprint $table) {
$table->id();
$table->string("name")->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('locations');
}
}
@@ -17,8 +17,11 @@ class CreateWashingMachines extends Migration
{
Schema::create('washing_machines', function (Blueprint $table) {
$table->id();
$table->string("name")->unique();
$table->string("name");
$table->foreignId("location_id")->constrained("locations", "id");
$table->timestamps();
$table->unique(['name', 'location_id']);
});
}
@@ -15,5 +15,6 @@ class DatabaseSeeder extends Seeder
$this->call(RoleSeeder::class);
$this->call(UserSeeder::class);
$this->call(ContactSeeder::class);
$this->call(LocationSeeder::class);
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Seeder;
class LocationSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$locationdata = [
[
"name" => "Bygning B"
],
[
"name" => "Bygning E"
]
];
foreach ($locationdata as $data) {
$location = new \App\Location();
$location->name = $data["name"];
$location->save();
}
}
}
+49 -3
View File
@@ -25,7 +25,7 @@ class PermissionSeeder extends Seeder
"ownuser.edit" => "Allows editing of your own user",
/**
* The CALENDAR specific permissions
* The CALENDAR specific permissions //TODO: Do we use them?
*/
"calendar.create" => "Create a new event.",
"calendar.list" => "Shows all events.",
@@ -51,63 +51,109 @@ class PermissionSeeder extends Seeder
"event.edit" => "Allows editing of events",
"event.delete" => "Allows deletion of events",
/**
* The CONTACT specific permissions
*/
"contact.create" => "Creates a new contact",
"contact.list" => "Shows all contacts",
"contact.show" => "Shows a specific contact",
"contact.edit" => "allows editing of contacts",
"contact.delete" => "Allows deletion of contacts",
/**
* The FEEDBACK specific permissions
*/
"feedback.create" => "Creates a new feedback message",
"feedback.list" => "Shows all feedback messages",
"feedback.show" => "Shows a specific feedback message",
"feedback.edit" => "allows editing of feedback messages",
"feedback.delete" => "allows deletion of feedback messages",
/**
* The MENUPLAN specific permissions
*/
"menuplan.create" => "Create a new menuplan",
"menuplan.list" => "Shows all menuplans",
"menuplan.show" => "Shows a specific menuplan",
"menuplan.edit" => "Allows editing of menuplans",
"menuplan.delete" => "Allows deletion of menuplans",
/**
* The RESOURCE CATEGORY specific permissions
*/
"resource.category.create" => "Create a new resource category",
"resource.category.list" => "Shows all resource categories",
"resource.category.show" => "Shows a specific resource category",
"resource.category.edit" => "Allows editing of resource categories",
"resource.category.delete" => "Allows deletion of resource categories",
/**
* The RESOURCE EXTENSION specific permissions
*/
"resource.extension.create" => "Create a new resource extension",
"resource.extension.list" => "Shows all resource extensions",
"resource.extension.show" => "Shows a specific resource extension",
"resource.extension.edit" => "Allows editing of resource extensions",
"resource.extension.delete" => "Allows deletion of resource extensions",
/**
* The RESOURCE specific permissions
*/
"resource.create" => "Create a new resource",
"resource.list" => "Shows all resources",
"resource.show" => "Shows a specific resource",
"resource.edit" => "Allows editing of resources",
"resource.delete" => "Allows deletion of resources",
/**
* The WASHING MACHINE specific permissions
*/
"washing.machine.create" => "Create a new washing machine",
"washing.machine.list" => "Shows all washing machines",
"washing.machine.show" => "Shows a specific washing machine",
"washing.machine.edit" => "Allows editing of washing machines",
"washing.machine.delete" => "Allows deletion of washing machines",
/**
* The WASHING MACHINE RESERVATION specific permissions
*/
"washing.machine.reservation.create" => "Create a new washing machine reservation",
"washing.machine.reservation.list" => "Shows all washing machine reservations",
"washing.machine.reservation.show" => "Shows a specific washing machine reservation",
"washing.machine.reservation.edit" => "Allows editing of washing machine reservations",
"washing.machine.reservation.delete" => "Allows deletion of washing machine reservations",
/**
* The ROLES specific permissions
*/
"roles.create" => "Create a new role",
"roles.list" => "Shows all roles",
"roles.show" => "Shows a specific role",
"roles.edit" => "Allows editing of roles",
"roles.delete" => "Allows deletion of roles",
//Allows access to the admin panel
"admin.panel.show" => "Allows access to administration panel",
/**
* The GUIDE specific permissions
*/
"guides.create" => "Create a new guide",
"guides.list" => "Shows all guides",
"guides.show" => "Shows a specific guide",
"guides.edit" => "Allows editing of guides",
"guides.delete" => "Allows deletion of guides",
/**
* The LOCATION specific permissions
*/
"locations.create" => "Create a new location",
"locations.list" => "Shows all locations",
"locations.show" => "Shows a specific location",
"locations.edit" => "Allows editing of locations",
"locations.delete" => "Allows deletion of locations",
/**
* The ADMIN PANEL specific permissions
*/
"admin.panel.show" => "Allows access to administration panel",
];
foreach ($permissions as $key => $value) {