This commit is contained in:
Vedde 2020-06-30 08:55:41 +02:00
parent 3b2fec0e09
commit 139e62dedf
21 changed files with 332 additions and 183 deletions

View File

@ -2,9 +2,84 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Album;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class AlbumController extends Controller class AlbumController 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 \App\Album $album
* @return \Illuminate\Http\Response
*/
public function show(Album $album)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Album $album
* @return \Illuminate\Http\Response
*/
public function edit(Album $album)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Album $album
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Album $album)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Album $album
* @return \Illuminate\Http\Response
*/
public function destroy(Album $album)
{
//
}
} }

View File

@ -9,6 +9,15 @@ use Illuminate\Http\Response;
class ExternalLinkController extends Controller class ExternalLinkController extends Controller
{ {
function __construct()
{
$this->middleware("permission:link.external.list")->only("index");
$this->middleware("permission:link.external.create")->only(["create", "store"]);
$this->middleware("permission:link.external.show")->only("show");
$this->middleware("permission:link.external.edit")->only(["edit", "update"]);
$this->middleware("permission:link.external.delete")->only("destroy");
}
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *

View File

@ -2,9 +2,84 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Image;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class ImageController extends Controller class ImageController 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 \App\Image $image
* @return \Illuminate\Http\Response
*/
public function show(Image $image)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Image $image
* @return \Illuminate\Http\Response
*/
public function edit(Image $image)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Image $image
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Image $image)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Image $image
* @return \Illuminate\Http\Response
*/
public function destroy(Image $image)
{
//
}
} }

View File

@ -14,13 +14,14 @@ class UserController extends Controller
{ {
public function __construct() public function __construct()
{ {
// $this->middleware([ "auth" ])->only("logout"); $this->middleware([ "auth" ])->only("logout");
// $this->middleware([ "guest" ])->only("login"); $this->middleware([ "guest" ])->only("login");
//
// $this->middleware([ "permission:user.list", "role:admin" ])->only("index"); $this->middleware([ "check.auth:user.list" ])->only("index");
// $this->middleware([ "permission:user.show", "role:admin" ])->only("show"); $this->middleware([ "check.auth:user.show" ])->only("show");
// $this->middleware([ "permission:user.edit", "role:admin" ])->only([ "edit", "update" ]); $this->middleware([ "check.auth:user.create" ])->only("create");
// $this->middleware([ "permission:user.delete", "role:admin" ])->only("delete"); $this->middleware([ "check.auth:user.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:user.delete" ])->only("delete");
} }
/** /**
@ -54,7 +55,7 @@ class UserController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
Log::debug("STORE FUNCTION"); // Log::debug("STORE FUNCTION");
$data = $request->validate([ $data = $request->validate([
"name_first" => "required|max:255", "name_first" => "required|max:255",
@ -65,15 +66,15 @@ class UserController extends Controller
]); ]);
Log::debug("FINISHED VALIDATION?"); // Log::debug("FINISHED VALIDATION?");
$user = new User($data); $user = new User($data);
Log::debug("CREATED USER [NOT PERSISTED YET]"); // Log::debug("CREATED USER [NOT PERSISTED YET]");
$user->save(); $user->save();
Log::debug("SAVED USER"); // Log::debug("SAVED USER");
return Response::detect("users.store"); return Response::detect("users.store");
} }
@ -182,7 +183,7 @@ class UserController extends Controller
/*******************************************/ /*******************************************/
public function showLogin() { public function showLogin() {
return view("admin.users.login"); return Response::detect("users.login");
} }
public function login(Request $request) { public function login(Request $request) {
@ -190,7 +191,7 @@ class UserController extends Controller
if(Auth::attempt($data)) { if(Auth::attempt($data)) {
//TODO: Implement home? //TODO: Implement home?
return redirect()->route("users.index"); return redirect()->route("root.index");
} }
return redirect()->back(303); return redirect()->back(303);
@ -199,6 +200,6 @@ class UserController extends Controller
public function logout(Request $request) { public function logout(Request $request) {
Auth::logout(); Auth::logout();
return redirect()->to("/"); return redirect()->route("root.index");
} }
} }

View File

@ -2,9 +2,84 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Video;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class VideoController extends Controller class VideoController 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 \App\Video $video
* @return \Illuminate\Http\Response
*/
public function show(Video $video)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Video $video
* @return \Illuminate\Http\Response
*/
public function edit(Video $video)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Video $video
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Video $video)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Video $video
* @return \Illuminate\Http\Response
*/
public function destroy(Video $video)
{
//
}
} }

View File

@ -67,5 +67,7 @@ class Kernel extends HttpKernel
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
"check.auth" => \App\Http\Middleware\CheckAuth::class
]; ];
} }

View File

@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class MenuPlan extends Model class MenuPlan extends Model
{ {
protected $fillable = [ protected $fillable = [
'monday', "tuesday", 'wednesday', 'thursday', "friday", "saturday", "sunday" 'monday', "tuesday", 'wednesday', 'thursday'
]; ];
} }

View File

@ -13,6 +13,9 @@ class CreateUsersTable extends Migration
*/ */
public function up() public function up()
{ {
if(Schema::hasTable("users"))
return;
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name_first'); $table->string('name_first');

View File

@ -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.'); throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
} }
Schema::create($tableNames['permissions'], function (Blueprint $table) { if(!Schema::hasTable("permissions"))
$table->bigIncrements('id'); {
$table->string('name'); Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->string('description'); $table->bigIncrements('id');
$table->string('guard_name'); $table->string('name');
$table->timestamps(); $table->string('description');
}); $table->string('guard_name');
$table->timestamps();
});
}
Schema::create($tableNames['roles'], function (Blueprint $table) { Schema::create($tableNames['roles'], function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');

View File

@ -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');
}
}

View File

@ -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');
}
}

View File

@ -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');
}
}

View File

@ -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');
}
}

View File

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

View File

@ -40,19 +40,29 @@ class PermissionSeeder extends Seeder
"link.external.edit" => "Allows editing of external links.", "link.external.edit" => "Allows editing of external links.",
"link.external.delete" => "Allows deletion 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) { 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->name = $key;
$permission->description = $value; $permission->description = $value;
$permission->save(); $permission->save();
}
} }
} }
} }

View File

@ -93,6 +93,7 @@ function generateCalendar(weekOffset = 0) {
function onDateSelect(date) { function onDateSelect(date) {
let events; let events;
let machinez; let machinez;
let buttonz;
let container = document.getElementById("event-container"); let container = document.getElementById("event-container");
@ -129,6 +130,23 @@ function onDateSelect(date) {
events = document.getElementById("events"); events = document.getElementById("events");
} }
if(document.getElementById("create-reservation") != undefined)
buttonz = document.getElementById("create-reservation");
else {
// let span = document.createElement("span");
// span.classList.add("events__title");
// span.innerText = "Tider";
let button = document.createElement("button");
// button.classList.add("events__title");
button.id = "create-reservation";
button.innerText = "Reserver";
// container.appendChild(span);
container.appendChild(button);
buttonz = document.getElementById("events");
}
// events.innerHTML = ""; // events.innerHTML = "";

View File

@ -19,8 +19,8 @@
</tr> </tr>
@foreach($links as $link) @foreach($links as $link)
<tr> <tr>
<th>{{$link->name}}</th> <td>{{$link->name}}</td>
<th><a href="{{$link->link}}">{{$link->link}}</th> <td><a href="{{$link->link}}">{{$link->link}}</td>
<td><a href="{{ route("external-links.edit", [ "external_link" => $link ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("external-links.edit", [ "external_link" => $link ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("external-links.destroy", [ "external_link" => $link ]) }}" class="w-100 nostyle"> <td><form method="post" action="{{ route("external-links.destroy", [ "external_link" => $link ]) }}" class="w-100 nostyle">
@csrf @csrf

View File

@ -50,23 +50,23 @@
</div> </div>
</div> </div>
<div class="segment"> <div class="segment">
<h3 class="text-white">Kontakter</h3> <h3 class="text-white">Eksterne Links</h3>
<div class="row"> <div class="row">
<a href="{{ route("contacts.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Kontakter</a> <a href="{{ route("external-links.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Links</a>
</div> </div>
<div class="row"> <div class="row">
<a href="{{ route("contacts.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a> <a href="{{ route('external-links.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Link</a>
</div>
</div>
<div class="segment">
<h3 class="text-white">Personale</h3>
<div class="row">
<a href="{{ route('staff.index') }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Personale</a>
</div>
<div class="row">
<a href="{{ route('staff.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Personal</a>
</div> </div>
</div> </div>
{{-- <div class="segment">--}}
{{-- <h3 class="text-white">Personale</h3>--}}
{{-- <div class="row">--}}
{{-- <a href="{{ route('staff.index') }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Personale</a>--}}
{{-- </div>--}}
{{-- <div class="row">--}}
{{-- <a href="{{ route('staff.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Personal</a>--}}
{{-- </div>--}}
{{-- </div>--}}
<div class="segment"> <div class="segment">
<h3 class="text-white">Feedback</h3> <h3 class="text-white">Feedback</h3>
<div class="row"> <div class="row">

View File

@ -16,6 +16,10 @@
</button> </button>
</header> </header>
<div class="d-none bg-sde-blue col" id="menu"> <div class="d-none bg-sde-blue col" id="menu">
<a href="{{ route("root.index") }}">
Home
</a>
<a href="{{ route("menu-plans.index") }}"> <a href="{{ route("menu-plans.index") }}">
<img src="{{URL::asset('/images/icons/Menuplan.svg')}}" alt="Menuplan"> <img src="{{URL::asset('/images/icons/Menuplan.svg')}}" alt="Menuplan">
Menuplan Menuplan
@ -28,15 +32,16 @@
<img src="{{URL::asset('/images/icons/Vaske booking liste.svg')}}" alt="Reservationer"> <img src="{{URL::asset('/images/icons/Vaske booking liste.svg')}}" alt="Reservationer">
Reservationer Reservationer
</a> </a>
{{-- IKKE SLETTES!!!! --}}
{{-- <a href="#">--}}
{{-- <img src="{{URL::asset('/images/icons/Galleri.svg')}}" alt="Galleri">--}}
{{-- Galleri--}}
{{-- </a>--}}
<a href="#"> <a href="#">
<img src="{{URL::asset('/images/icons/Galleri.svg')}}" alt="Galleri">
Galleri
</a>
<a href="{{ route("contacts.index") }}">
<img src="{{URL::asset('/images/icons/Kontoret.svg')}}" alt="Kontoret"> <img src="{{URL::asset('/images/icons/Kontoret.svg')}}" alt="Kontoret">
Kontoret Kontoret
</a> </a>
<a href="#"> <a href="{{ route("phones.index") }}">
<img src="{{URL::asset('/images/icons/Vagttelefon-hvid.svg')}}" alt="Vagttelefon"> <img src="{{URL::asset('/images/icons/Vagttelefon-hvid.svg')}}" alt="Vagttelefon">
Vagttelefon Vagttelefon
</a> </a>

View File

@ -25,11 +25,13 @@ Route::post("/login", "UserController@login")->name("users.login");
Route::get("/logout", "UserController@logout")->name("users.logout"); Route::get("/logout", "UserController@logout")->name("users.logout");
Route::get("phones", "PhoneController@index")->name("phones.index");
Route::resource("contacts", "ContactController"); Route::resource("contacts", "ContactController");
Route::resource("menu-plans", "MenuPlanController"); Route::resource("menu-plans", "MenuPlanController");
Route::resource("users", "UserController"); Route::resource("users", "UserController");
Route::resource("staff", "StaffController"); //Route::resource("staff", "StaffController");
Route::resource("events", "EventController"); Route::resource("events", "EventController");
Route::resource("washing-machines", "WashingMachineController"); Route::resource("washing-machines", "WashingMachineController");
Route::resource("washing-reservations", "WashingReservationController"); Route::resource("washing-reservations", "WashingReservationController");

File diff suppressed because one or more lines are too long