Role frontend

This commit is contained in:
frederikpyt 2020-06-30 11:31:12 +02:00
parent 8415338120
commit df679536de
8 changed files with 137 additions and 45 deletions

View File

@ -1,45 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Traits\HasRoles;
class Staff extends Model
{
use Notifiable;
use HasRoles;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name_first', "name_last", 'email', 'password', "phone"
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function setPasswordAttribute($password) {
$this->attributes["password"] = Hash::make($password);
}
}

View File

@ -0,0 +1,22 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Opret
@endsection
@section("path")
<a href="{{ route('roles.create') }}" class="text-white">Opret Rolle</a> /
@endsection
@section("content")
<h1>Opret Rolle:</h1>
<form method="post" action="{{ route("roles.store") }}">
@csrf
<label for="name">Navn:</label>
<input type="text" name="name" id="name" placeholder="Admin" required>
<label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection

View File

@ -0,0 +1,13 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Fjern
@endsection
@section("path")
<a href="{{ route('roles.delete') }}" class="text-white">Fjern Rolle</a> /
@endsection
@section("content")
@endsection

View File

@ -0,0 +1,23 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Rediger
@endsection
@section("path")
<a href="{{ route('roles.edit', ['role' => $role]) }}" class="text-white">Rediger Rolle</a> /
@endsection
@section("content")
<h1>Rediger Rolle:</h1>
<form method="post" action="{{ route("roles.update", ['role' => $role]) }}">
@csrf
@method("put")
<label for="name">Navn:</label>
<input type="text" name="name" id="name" placeholder="Admin" value="{{ role->name }}" required>
<label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" value="{{ role->description }}" required>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection

View File

@ -0,0 +1,37 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Vis
@endsection
@section("path")
<a href="{{ route('roles.index') }}" class="text-white">Vis Roller</a> /
@endsection
@section("content")
<table class="tbl">
<tr>
<th>Navn</th>
<th>Beskrivelse</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($roles as $role)
<tr>
<td>{{ $role->name }}</td>
<td>{{ $role->description }}</td>
<td><a href="{{ route("roles.edit", [ "role" => $role->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("roles.destroy", [ "role" => $role ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>
@endforeach
</table>
{{ $users->links() }}
@endsection

View File

@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Vis
@endsection
@section("path")
<a href="{{ route('rolle.index') }}" class="text-white">Vis Brugere</a> /
@endsection
@section("content")
show.blade.php
@endsection

View File

@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Opret
@endsection
@section("path")
<a href="{{ route('roles.create') }}" class="text-white">Opret Roller</a> /
@endsection
@section("content")
Rollen blev (ikke) oprettet.
@endsection

View File

@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Rediger
@endsection
@section("path")
<a href="{{ route('roles.edit') }}" class="text-white">Rediger Rolle</a> /
@endsection
@section("content")
Din rolle blev (ikke) redigeret.
@endsection