Added first seeder.

This commit is contained in:
Sebastian Davaris 2020-06-08 15:08:46 +02:00
parent 5abeec4ceb
commit bd23d10a9d
16 changed files with 221 additions and 5 deletions

11
.idea/dataSources.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="laravel.sqlite" uuid="9d32b2d2-cbb3-4fd4-8566-2790c2a354f4">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/skolehjem/database/laravel.sqlite</jdbc-url>
</data-source>
</component>
</project>

BIN
PERMS.ods Normal file

Binary file not shown.

View File

@ -10,3 +10,5 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/public/css/app.css
/public/js/app.js

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class RootController extends Controller
{
public function index() {
return view("index");
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@ -3,12 +3,16 @@
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
use SoftDeletes;
use Notifiable;
use HasRoles;
/**
* The attributes that are mass assignable.

View File

@ -23,6 +23,7 @@ class CreatePermissionTables extends Migration
Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('description');
$table->string('guard_name');
$table->timestamps();
});
@ -30,6 +31,7 @@ class CreatePermissionTables extends Migration
Schema::create($tableNames['roles'], function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('description');
$table->string('guard_name');
$table->timestamps();
});

View File

@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(UserSeeder::class);
$this->call(PermissionSeeder::class);
}
}

View File

@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
class PermissionSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$permissions = [
/**
* The USER specific permissions
*/
"user.list" => "Access to list the users.",
"user.show" => "Shows another user profile.",
"user.edit" => "Allows editing of other users.",
"user.delete" => "Allows deleting of other users.",
/**
* The CALENDAR specific permissions
*/
"calendar.create" => "Create a new event.",
"calendar.list" => "Shows all events.",
"calendar.show" => "Shows a specific event.",
"calendar.edit" => "Allows editing of events.",
"calendar.delete" => "Allows the deletion of events.",
/**
* The EXTERNAL LINK specific permissions
*/
"link.external.create" => "Create a new external link.",
"link.external.list" => "List all external links.",
"link.external.show" => "Show a specific external link",
"link.external.edit" => "Allows editing of external links.",
"link.external.delete" => "Allows deletion of external links",
];
foreach ($permissions as $key => $value) {
if(Permission::findByName($key))
continue;
$permission = new Permission();
$permission->name = $key;
$permission->description = $value;
$permission->save();
}
}
}

View File

@ -2982,6 +2982,12 @@
"type": "^1.0.1"
}
},
"de-indent": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
"integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=",
"dev": true
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
@ -9201,6 +9207,16 @@
"loader-utils": "^1.0.2"
}
},
"vue-template-compiler": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz",
"integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==",
"dev": true,
"requires": {
"de-indent": "^1.0.2",
"he": "^1.1.0"
}
},
"vue-template-es2015-compiler": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz",

View File

@ -16,6 +16,7 @@
"lodash": "^4.17.13",
"resolve-url-loader": "^3.1.0",
"sass": "^1.15.2",
"sass-loader": "^8.0.0"
"sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.11"
}
}

View File

@ -0,0 +1,4 @@
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}

View File

@ -1 +1,5 @@
//
* {
margin: 0;
}

View File

@ -0,0 +1,5 @@
@extends("layout.base")
@section("content")
Hej
@endsection

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="{{ mix("/css/app.css") }}">
</head>
<body>
@yield("content")
<script src="{{ mix("/js/app.js") }}"></script>
</body>
</html>

View File

@ -13,6 +13,8 @@ use Illuminate\Support\Facades\Route;
|
*/
Route::get('/', function () {
return view('welcome');
});
//Route::get('/', function () {
// return view('welcome');
//});
Route::get("/", "RootController@index")->name("root.index");