diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php index 92c82bb..efafadd 100644 --- a/skolehjem/app/Http/Controllers/UserController.php +++ b/skolehjem/app/Http/Controllers/UserController.php @@ -154,6 +154,13 @@ class UserController extends Controller /** @var User $user */ $user->update($data); + $user->roles()->detach(); + $user->forgetCachedPermissions(); + + foreach ($request->roles as $role){ + $user->assignRole($role); + } + $user->save(); // } @@ -231,5 +238,13 @@ class UserController extends Controller return redirect()->route('users.login'); } + public function account() + { + return Response::detect("users.account"); + } + public function accountedit() + { + return Response::detect("users.edit"); + } } diff --git a/skolehjem/app/User.php b/skolehjem/app/User.php index a7a7023..ac8b735 100644 --- a/skolehjem/app/User.php +++ b/skolehjem/app/User.php @@ -21,7 +21,7 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name_first', "name_last", 'email', 'password', "phone", "roles" + 'name_first', "name_last", 'email', 'password', "phone" ]; /** diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php index 2d39848..dc0d212 100644 --- a/skolehjem/resources/views/admin/contacts/index.blade.php +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -30,7 +30,7 @@ @csrf @method("delete") - + diff --git a/skolehjem/resources/views/admin/events/index.blade.php b/skolehjem/resources/views/admin/events/index.blade.php index 8a6c273..95e6bb1 100644 --- a/skolehjem/resources/views/admin/events/index.blade.php +++ b/skolehjem/resources/views/admin/events/index.blade.php @@ -28,7 +28,7 @@ @csrf @method("delete") - + diff --git a/skolehjem/resources/views/admin/external-links/index.blade.php b/skolehjem/resources/views/admin/external-links/index.blade.php index e9f726b..069db81 100644 --- a/skolehjem/resources/views/admin/external-links/index.blade.php +++ b/skolehjem/resources/views/admin/external-links/index.blade.php @@ -26,7 +26,7 @@ @csrf @method("delete") - + diff --git a/skolehjem/resources/views/admin/menuplans/index.blade.php b/skolehjem/resources/views/admin/menuplans/index.blade.php index f5ceebf..e1f75d2 100644 --- a/skolehjem/resources/views/admin/menuplans/index.blade.php +++ b/skolehjem/resources/views/admin/menuplans/index.blade.php @@ -32,7 +32,7 @@ @csrf @method("delete") - + diff --git a/skolehjem/resources/views/admin/roles/index.blade.php b/skolehjem/resources/views/admin/roles/index.blade.php index 47d2d5e..29aab0d 100644 --- a/skolehjem/resources/views/admin/roles/index.blade.php +++ b/skolehjem/resources/views/admin/roles/index.blade.php @@ -26,7 +26,7 @@ @csrf @method("delete") - + diff --git a/skolehjem/resources/views/admin/staff/create.blade.php b/skolehjem/resources/views/admin/staff/create.blade.php deleted file mode 100644 index 3430725..0000000 --- a/skolehjem/resources/views/admin/staff/create.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Opret -@endsection - -@section("path") - Opret Personal / -@endsection - -@section("content") -

Opret Personal:

-
- @csrf - - - - - - - - - - - - - -
-@endsection diff --git a/skolehjem/resources/views/admin/staff/delete.blade.php b/skolehjem/resources/views/admin/staff/delete.blade.php deleted file mode 100644 index 4c3f81e..0000000 --- a/skolehjem/resources/views/admin/staff/delete.blade.php +++ /dev/null @@ -1,13 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Fjern -@endsection - -@section("path") - Fjern Personal / -@endsection - -@section("content") -@endsection diff --git a/skolehjem/resources/views/admin/staff/edit.blade.php b/skolehjem/resources/views/admin/staff/edit.blade.php deleted file mode 100644 index aa0b337..0000000 --- a/skolehjem/resources/views/admin/staff/edit.blade.php +++ /dev/null @@ -1,31 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Rediger -@endsection - -@section("path") - Rediger Personal / -@endsection - -@section("content") -

Rediger Personal:

-
$staff]) }}"> - @csrf - @method("put") - - - - - - - - - - - - - -
-@endsection diff --git a/skolehjem/resources/views/admin/staff/index.blade.php b/skolehjem/resources/views/admin/staff/index.blade.php deleted file mode 100644 index 52c333d..0000000 --- a/skolehjem/resources/views/admin/staff/index.blade.php +++ /dev/null @@ -1,41 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Vis -@endsection - -@section("path") - Vis Personal / -@endsection - -@section("content") - - - - - - - - - - @foreach($staffs as $staff) - - - - - - - - - @endforeach -
FornavnEfternavnEmailTlf nrUpdateDelete
{{ $staff->name_first }}{{ $staff->name_last }}{{ $staff->email }}{{ $staff->phone }} $staff->id ]) }}">Update
$staff->id ]) }}" class="w-100 nostyle"> - @csrf - @method("delete") - - -
-
- - {{ $staffs->links() }} -@endsection diff --git a/skolehjem/resources/views/admin/staff/login.blade.php b/skolehjem/resources/views/admin/staff/login.blade.php deleted file mode 100644 index 5accdac..0000000 --- a/skolehjem/resources/views/admin/staff/login.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@extends("app.layout.base") - -@section("title") - Login -@endsection - -@section("content") -
-
- Syddansk Erhvervsskole -
-
- @csrf - - - - - -
- Forgot password? -
-@endsection diff --git a/skolehjem/resources/views/admin/staff/logout.blade.php b/skolehjem/resources/views/admin/staff/logout.blade.php deleted file mode 100644 index d364bbd..0000000 --- a/skolehjem/resources/views/admin/staff/logout.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Home - Logud -@endsection - -@section("path") - Logud / -@endsection - -@section("content") - -@endsection diff --git a/skolehjem/resources/views/admin/staff/show.blade.php b/skolehjem/resources/views/admin/staff/show.blade.php deleted file mode 100644 index 5563064..0000000 --- a/skolehjem/resources/views/admin/staff/show.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Vis -@endsection - -@section("path") - Vis Personal / -@endsection - -@section("content") - show.blade.php -@endsection diff --git a/skolehjem/resources/views/admin/staff/store.blade.php b/skolehjem/resources/views/admin/staff/store.blade.php deleted file mode 100644 index 43ae210..0000000 --- a/skolehjem/resources/views/admin/staff/store.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Opret -@endsection - -@section("path") - Opret Personal / -@endsection - -@section("content") - Personal blev (ikke) oprettet. -@endsection diff --git a/skolehjem/resources/views/admin/staff/update.blade.php b/skolehjem/resources/views/admin/staff/update.blade.php deleted file mode 100644 index 7f7a25f..0000000 --- a/skolehjem/resources/views/admin/staff/update.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Personal - Rediger -@endsection - -@section("path") - Rediger Personal / -@endsection - -@section("content") - Din Personal blev (ikke) redigeret. -@endsection diff --git a/skolehjem/resources/views/admin/users/create.blade.php b/skolehjem/resources/views/admin/users/create.blade.php index 6cc39a2..0802da9 100644 --- a/skolehjem/resources/views/admin/users/create.blade.php +++ b/skolehjem/resources/views/admin/users/create.blade.php @@ -25,9 +25,9 @@ - - + @foreach($roles as $role) @endforeach diff --git a/skolehjem/resources/views/admin/users/edit.blade.php b/skolehjem/resources/views/admin/users/edit.blade.php index f369a60..7025b63 100644 --- a/skolehjem/resources/views/admin/users/edit.blade.php +++ b/skolehjem/resources/views/admin/users/edit.blade.php @@ -27,8 +27,8 @@ - + @foreach($roles as $role) @endforeach diff --git a/skolehjem/resources/views/admin/users/index.blade.php b/skolehjem/resources/views/admin/users/index.blade.php index d40a09c..f778fe1 100644 --- a/skolehjem/resources/views/admin/users/index.blade.php +++ b/skolehjem/resources/views/admin/users/index.blade.php @@ -16,7 +16,7 @@ Efternavn Email Tlf nr - Rolle + Rolle(r) Update Delete @@ -26,13 +26,21 @@ {{ $user->name_last }} {{ $user->email }} {{ $user->phone }} - {{ $user->roles }} + + @for($i = 0; $i < count($user->roles); $i++) + @if(count($user->roles)-1 != $i) + {{$user->roles[$i]->name}}, + @else + {{$user->roles[$i]->name}} + @endif + @endfor + $user->id ]) }}">Update
$user ]) }}" class="w-100 nostyle"> @csrf @method("delete") - +
diff --git a/skolehjem/resources/views/admin/washing-machines/index.blade.php b/skolehjem/resources/views/admin/washing-machines/index.blade.php index 07d7b95..f7a9d97 100644 --- a/skolehjem/resources/views/admin/washing-machines/index.blade.php +++ b/skolehjem/resources/views/admin/washing-machines/index.blade.php @@ -20,7 +20,13 @@ {Navn} Update - Delete +
$machine ]) }}" class="w-100 nostyle"> + @csrf + @method("delete") + + +
+ @endforeach diff --git a/skolehjem/resources/views/admin/washing-reservations/index.blade.php b/skolehjem/resources/views/admin/washing-reservations/index.blade.php index 7818ca2..cc31d74 100644 --- a/skolehjem/resources/views/admin/washing-reservations/index.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/index.blade.php @@ -30,7 +30,7 @@ @csrf @method("delete") - + diff --git a/skolehjem/resources/views/app/layout/base.blade.php b/skolehjem/resources/views/app/layout/base.blade.php index 5d9f5a2..38a9ea8 100644 --- a/skolehjem/resources/views/app/layout/base.blade.php +++ b/skolehjem/resources/views/app/layout/base.blade.php @@ -45,7 +45,7 @@ Vagttelefon Vagttelefon - + Konto Konto diff --git a/skolehjem/resources/views/app/users/account.blade.php b/skolehjem/resources/views/app/users/account.blade.php new file mode 100644 index 0000000..1572b8f --- /dev/null +++ b/skolehjem/resources/views/app/users/account.blade.php @@ -0,0 +1,15 @@ +@extends("app.layout.base") + +@section("title") + Account +@endsection + +@section("content") +
+

Konto

+

Navn: {{ Auth::user()->name_first . " " . Auth::user()->name_last }}

+

Email: {{ Auth::user()->email }}

+

Telefon Nr.: {{ Auth::user()->phone }}

+ Rediger Oplysninger +
+@endsection diff --git a/skolehjem/resources/views/app/users/edit.blade.php b/skolehjem/resources/views/app/users/edit.blade.php new file mode 100644 index 0000000..73ee773 --- /dev/null +++ b/skolehjem/resources/views/app/users/edit.blade.php @@ -0,0 +1,20 @@ +@extends("app.layout.base") + +@section("title") + Account +@endsection + +@section("content") +
+

Konto

+
+ Navn: + name_last }}" disabled> + Email: + + Telefon Nr.: + + +
+
+@endsection diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index 0bf70be..38e1ae5 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -25,7 +25,8 @@ Route::post("/login", "UserController@login")->name("users.login"); Route::get("/logout", "UserController@logout")->name("users.logout"); Route::get("/forgot", "UserController@showForgot")->name("users.show-forgot"); Route::post("/forgot", "UserController@forgot")->name("users.forgot"); - +Route::get("/account", "UserController@account")->name("users.account"); +Route::get("/account/edit", "UserController@accountedit")->name("users.accountedit"); Route::get("phones", "PhoneController@index")->name("phones.index");