Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
commit
aea1b0af04
|
@ -8,6 +8,17 @@ use App\Contact;
|
|||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:contact.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:contact.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:contact.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:contact.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:contact.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
|
|
@ -10,6 +10,17 @@ use Illuminate\Http\Response;
|
|||
|
||||
class EventController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:event.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:event.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:event.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:event.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:event.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource..
|
||||
*
|
||||
|
|
|
@ -9,6 +9,17 @@ use Illuminate\Http\Response;
|
|||
|
||||
class FeedbackController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:feedback.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:feedback.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:feedback.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:feedback.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:feedback.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Image;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -10,6 +10,17 @@ use Illuminate\Http\Response;
|
|||
|
||||
class MenuPlanController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:menuplan.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:menuplan.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:menuplan.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:menuplan.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:menuplan.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
@ -99,7 +110,7 @@ class MenuPlanController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,17 @@ use Illuminate\Http\Response;
|
|||
|
||||
class ResourceCategoryController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:resource.category.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:resource.category.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:resource.category.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:resource.category.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:resource.category.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
|
|
@ -7,6 +7,17 @@ use Illuminate\Http\Response;
|
|||
|
||||
class ResourceController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:resource.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:resource.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:resource.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:resource.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:resource.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
@ -14,7 +25,7 @@ class ResourceController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,17 @@ use Illuminate\Http\Response;
|
|||
|
||||
class ResourceExtensionController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:resource.extension.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:resource.extension.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:resource.extension.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:resource.extension.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:resource.extension.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
|
|
@ -1,185 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Staff;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class StaffController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware([ "auth" ])->only("logout");
|
||||
// $this->middleware([ "guest" ])->only("login");
|
||||
//
|
||||
// $this->middleware([ "permission:staff.list", "role:admin" ])->only("index");
|
||||
// $this->middleware([ "permission:staff.show", "role:admin" ])->only("show");
|
||||
// $this->middleware([ "permission:staff.edit", "role:admin" ])->only([ "edit", "update" ]);
|
||||
// $this->middleware([ "permission:staff.delete", "role:admin" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$staffs = Staff::query()->paginate($request->query("page", 20));
|
||||
|
||||
return Response::detect("staff.index", [ "staffs" => $staffs ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return Response::detect("staff.create");
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
"name_first" => "required|max:255",
|
||||
"name_last" => "required|max:255",
|
||||
"email" => "required|email|unique:staff",
|
||||
"password" => "required|max:60",
|
||||
"phone" => "required|unique:staff"
|
||||
|
||||
]);
|
||||
|
||||
$staff = new Staff($data);
|
||||
$staff->save();
|
||||
|
||||
return Response::detect("staff.store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$staff = Staff::find($id);
|
||||
|
||||
return Response::detect("staff.show", [
|
||||
"staff" => $staff
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$staff = Staff::find($id);
|
||||
|
||||
return Response::detect("staff.edit", [
|
||||
"staff" => $staff
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$data = $request->all();
|
||||
|
||||
// $data = $request->validate([
|
||||
// "name_first" => "max:255",
|
||||
// "name_last" => "max:255",
|
||||
// "email" => "email|unique:staff",
|
||||
// "password" => "max:60",
|
||||
// "phone" => "unique:staff",
|
||||
// ]);
|
||||
|
||||
// Validates if the staff is updating itself or another staff.
|
||||
// if($id === Auth::id()) {
|
||||
// $staff = Auth::staff();
|
||||
//
|
||||
// $staff->update($data);
|
||||
//
|
||||
// $staff->save();
|
||||
// return Response::detect("staff.edit", [
|
||||
// "staff" => $staff
|
||||
// ]);
|
||||
// }
|
||||
|
||||
//TODO: Implement when security's ready!!!
|
||||
// else if(Auth::staff()->hasPermissionTo("staff.edit")) {
|
||||
$staff = Staff::find($id);
|
||||
|
||||
/** @var Staff $staff */
|
||||
$staff->update($data);
|
||||
|
||||
$staff->save();
|
||||
// }
|
||||
|
||||
$staffs = Staff::query()->paginate(20);
|
||||
|
||||
return Response::detect("staff.index", [
|
||||
"staffs" => $staffs
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function destroy(Staff $id)
|
||||
{
|
||||
$id->delete();
|
||||
return redirect()->route("staff.index");
|
||||
}
|
||||
|
||||
/*******************************************/
|
||||
/* Authentication */
|
||||
/*******************************************/
|
||||
|
||||
public function showLogin() {
|
||||
return view("admin.staff.login");
|
||||
}
|
||||
|
||||
public function login(Request $request) {
|
||||
$data = $request->only("email", "password");
|
||||
|
||||
if(Auth::attempt($data)) {
|
||||
//TODO: Implement home?
|
||||
return redirect()->route("staff.index");
|
||||
}
|
||||
|
||||
return redirect()->back(303);
|
||||
}
|
||||
|
||||
public function logout(Request $request) {
|
||||
Auth::logout();
|
||||
|
||||
return redirect()->to("/");
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Video;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -9,6 +9,17 @@ use App\WashingMachine;
|
|||
|
||||
class WashingMachineController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:washing.machine.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:washing.machine.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:washing.machine.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:washing.machine.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:washing.machine.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
|
|
@ -9,6 +9,17 @@ use App\WashingReservation;
|
|||
|
||||
class WashingReservationController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ]);
|
||||
|
||||
$this->middleware([ "check.auth:washing.machine.reservation.list" ])->only("index");
|
||||
$this->middleware([ "check.auth:washing.machine.reservation.show" ])->only("show");
|
||||
$this->middleware([ "check.auth:washing.machine.reservation.create" ])->only("create", "store");
|
||||
$this->middleware([ "check.auth:washing.machine.reservation.edit" ])->only("edit", "update");
|
||||
$this->middleware([ "check.auth:washing.machine.reservation.delete" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
|
|
@ -15,7 +15,7 @@ class Authenticate extends Middleware
|
|||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
return route('users.login');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,14 +40,64 @@ class PermissionSeeder extends Seeder
|
|||
"link.external.edit" => "Allows editing of external links.",
|
||||
"link.external.delete" => "Allows deletion of external links",
|
||||
|
||||
/**
|
||||
* The EVENT specific permissions
|
||||
*/
|
||||
"event.create" => "Create a new event",
|
||||
"event.list" => "Shows all events",
|
||||
"event.show" => "Shows event",
|
||||
"event.edit" => "Edit event",
|
||||
"event.delete" => "Deletes an event",
|
||||
"event.show" => "Shows a specific event",
|
||||
"event.edit" => "Allows editing of events",
|
||||
"event.delete" => "Allows deletion of events",
|
||||
|
||||
"contact.create" => "Creates a new contact",
|
||||
"contact.list" => ""
|
||||
"contact.list" => "Shows all contacts",
|
||||
"contact.show" => "Shows a specific contact",
|
||||
"contact.edit" => "allows editing of contacts",
|
||||
"contact.delete" => "Allows deletion of contacts",
|
||||
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
||||
|
||||
];
|
||||
|
||||
foreach ($permissions as $key => $value) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
|
@ -11,6 +12,13 @@ class UserSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
try {
|
||||
if(User::findByName("admin"))
|
||||
return;
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
$user = new \App\User();
|
||||
|
||||
$user->name_first = "admin";
|
||||
|
@ -19,6 +27,8 @@ class UserSeeder extends Seeder
|
|||
$user->setPasswordAttribute("1234");
|
||||
$user->phone = 12345678;
|
||||
|
||||
|
||||
|
||||
foreach (\Spatie\Permission\Models\Permission::all() as $permission) {
|
||||
$user->givePermissionTo($permission);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="brand">
|
||||
<img src="{{URL::asset('/images/logos/Logo-hvid.svg')}}" alt="Syddansk Erhvervsskole">
|
||||
</div>
|
||||
<form action="" method="post">
|
||||
<form action="{{ route("users.login") }}" method="post">
|
||||
@csrf
|
||||
<input class="appinput" type="email" name="email" placeholder="Email" required>
|
||||
<input class="appinput" type="password" name="password" placeholder="Password" required>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue