From c6282b77d1cfd4520986c9432b6c13fbd1ec587d Mon Sep 17 00:00:00 2001 From: Anders <anders164a@gmail.com> Date: Fri, 26 Jun 2020 12:20:20 +0200 Subject: [PATCH 01/25] Renamed 'Booking' to 'Vaske Reservationer' in washing-reservations --- .../views/admin/washing-reservations/create.blade.php | 4 ++-- .../views/admin/washing-reservations/delete.blade.php | 4 ++-- .../views/admin/washing-reservations/edit.blade.php | 4 ++-- .../views/admin/washing-reservations/index.blade.php | 4 ++-- .../views/admin/washing-reservations/show.blade.php | 4 ++-- .../views/admin/washing-reservations/store.blade.php | 6 +++--- .../views/admin/washing-reservations/update.blade.php | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/skolehjem/resources/views/admin/washing-reservations/create.blade.php b/skolehjem/resources/views/admin/washing-reservations/create.blade.php index 5460e31..01d38ad 100644 --- a/skolehjem/resources/views/admin/washing-reservations/create.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/create.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Opret + Vaske Reservationer - Opret @endsection @section("path") - <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Booking</a> / + <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/delete.blade.php b/skolehjem/resources/views/admin/washing-reservations/delete.blade.php index faf2283..1fdbf71 100644 --- a/skolehjem/resources/views/admin/washing-reservations/delete.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/delete.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Fjern + Vaske Reservationer - Fjern @endsection @section("path") - <a href="" class="text-white">Fjern Booking</a> / + <a href="" class="text-white">Fjern Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/edit.blade.php b/skolehjem/resources/views/admin/washing-reservations/edit.blade.php index 036dbf0..66e0edb 100644 --- a/skolehjem/resources/views/admin/washing-reservations/edit.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/edit.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Rediger + Vaske Reservationer - Rediger @endsection @section("path") - <a href="{{ route('washing-reservations.edit', ['id' => $reservations->id]) }}" class="text-white">Rediger Booking</a> / + <a href="{{ route('washing-reservations.edit', ['id' => $reservations->id]) }}" class="text-white">Rediger Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/index.blade.php b/skolehjem/resources/views/admin/washing-reservations/index.blade.php index 251ea53..88c4d5a 100644 --- a/skolehjem/resources/views/admin/washing-reservations/index.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/index.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Vis + Vaske Reservationer - Vis @endsection @section("path") - <a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Booking</a> / + <a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/show.blade.php b/skolehjem/resources/views/admin/washing-reservations/show.blade.php index 9971c49..a77b6b7 100644 --- a/skolehjem/resources/views/admin/washing-reservations/show.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/show.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Vis + Vaske Reservationer - Vis @endsection @section("path") - <a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Booking</a> / + <a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/store.blade.php b/skolehjem/resources/views/admin/washing-reservations/store.blade.php index 616c3e8..85ed1d7 100644 --- a/skolehjem/resources/views/admin/washing-reservations/store.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/store.blade.php @@ -2,13 +2,13 @@ @extends("admin.layout.header") @section("title") - Booking - Opret + Vaske Reservationer - Opret @endsection @section("path") - <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Booking</a> / + <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaske Reservationer</a> / @endsection @section("content") - Booking blev (ikke) oprettet. + Vaske Reservationer blev (ikke) oprettet. @endsection diff --git a/skolehjem/resources/views/admin/washing-reservations/update.blade.php b/skolehjem/resources/views/admin/washing-reservations/update.blade.php index 9dd8408..f890995 100644 --- a/skolehjem/resources/views/admin/washing-reservations/update.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/update.blade.php @@ -2,13 +2,13 @@ @extends("admin.layout.header") @section("title") - Booking - Rediger + Vaske Reservationer - Rediger @endsection @section("path") - <a href="{{ route('washing-reservations.edit') }}" class="text-white">Rediger Booking</a> / + <a href="{{ route('washing-reservations.edit') }}" class="text-white">Rediger Vaske Reservationer</a> / @endsection @section("content") - Din booking blev (ikke) redigeret. + Din Vaske Reservationer blev (ikke) redigeret. @endsection From b555af06c7eb94daf87cdb0965ff0f5aca33a1f0 Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 10:30:09 +0200 Subject: [PATCH 02/25] Lavet contact create controller --- skolehjem/app/Contact.php | 4 +++- .../app/Http/Controllers/ContactController.php | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/skolehjem/app/Contact.php b/skolehjem/app/Contact.php index c035b2a..5570122 100644 --- a/skolehjem/app/Contact.php +++ b/skolehjem/app/Contact.php @@ -6,5 +6,7 @@ use Illuminate\Database\Eloquent\Model; class Contact extends Model { - // + protected $fillable = [ + 'monday', "tuesday", 'wednesday', 'thursday', "friday", "saturday", "sunday" + ]; } diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 63eea17..5da67c6 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -28,7 +28,8 @@ class ContactController extends Controller */ public function create() { - // + return Response::detect("contacts.create"); + } /** @@ -39,7 +40,15 @@ class ContactController extends Controller */ public function store(Request $request) { - // + $requestContact = $request->validate([ + "idk kev" => "required|max:255", + + ]); + + $contact = new MenuPlan($requestContact); + $contact->save(); + + return Response::detect("contacts.store"); } /** From 488995ca37792456072e32f246736df639656fe3 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 10:31:24 +0200 Subject: [PATCH 03/25] Contact frontend --- .../views/admin/contact/create.blade.php | 26 +++++++++++++++ .../views/admin/contact/index.blade.php | 33 +++++++++++++++++++ .../views/admin/layout/base.blade.php | 3 ++ 3 files changed, 62 insertions(+) create mode 100644 skolehjem/resources/views/admin/contact/create.blade.php create mode 100644 skolehjem/resources/views/admin/contact/index.blade.php diff --git a/skolehjem/resources/views/admin/contact/create.blade.php b/skolehjem/resources/views/admin/contact/create.blade.php new file mode 100644 index 0000000..9e95044 --- /dev/null +++ b/skolehjem/resources/views/admin/contact/create.blade.php @@ -0,0 +1,26 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakter - Opret +@endsection + +@section("path") + <a href="" class="text-white">Opret Kontakt</a> / +@endsection + +@section("content") + <h1>Opret Kontakt:</h1> + <form method="post" action="{{ route("contacts.store") }}"> + @csrf + <label for="name_first">Fornavn:</label> + <input type="text" name="name_first" id="name_first" placeholder="Fornavn" required> + <label for="name_last">Efternavn:</label> + <input type="text" name="name_last" id="name_last" placeholder="Efternavn" required> + <label for="email">Email:</label> + <input type="email" name="email" id="email" placeholder="x@y.z" required> + <label for="tel">Telefon nr:</label> + <input type="tel" name="phone" id="tel" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required> + <input type="submit" class="btn btn-dark text-white" value="Opret"> + </form> +@endsection diff --git a/skolehjem/resources/views/admin/contact/index.blade.php b/skolehjem/resources/views/admin/contact/index.blade.php new file mode 100644 index 0000000..da92e7e --- /dev/null +++ b/skolehjem/resources/views/admin/contact/index.blade.php @@ -0,0 +1,33 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Events - Vis +@endsection + +@section("path") + <a href="" class="text-white">Vis Kontakter</a> / +@endsection + +@section("content") + <table class="tbl"> + <tr> + <th>Kontakt Navn</th> + <th>Titel</th> + <th>E-mail</th> + <th>Tlf</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($contacts as $contact) + <tr> + <td>{{ $contact->name }}</td> + <td>{{ $contact->title }}</td> + <td>{{ $contact->email }}</td> + <td>{{ $contact->phone }}</td> + <td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> + <td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> + </tr> + @endforeach + </table> +@endsection diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index 0706b73..c5eecc5 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -45,6 +45,9 @@ <div class="row"> <a href="{{ route("contacts.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Kontakter</a> </div> + <div class="row"> + <a href="{{ route("contacts.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a> + </div> </div> </div> <div class="w-85" style="background-color: #cccccc;"> From bb307df506b16a5689049d4f3224d0107aee06a9 Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 10:37:37 +0200 Subject: [PATCH 04/25] ikd kev --- skolehjem/app/Contact.php | 2 +- skolehjem/app/Http/Controllers/ContactController.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/skolehjem/app/Contact.php b/skolehjem/app/Contact.php index 5570122..74d306b 100644 --- a/skolehjem/app/Contact.php +++ b/skolehjem/app/Contact.php @@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; class Contact extends Model { protected $fillable = [ - 'monday', "tuesday", 'wednesday', 'thursday', "friday", "saturday", "sunday" + 'name_first', "name_last", 'email', 'tel' ]; } diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 5da67c6..c899c69 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -28,7 +28,7 @@ class ContactController extends Controller */ public function create() { - return Response::detect("contacts.create"); + return Response::detect("contact.create"); } @@ -41,8 +41,10 @@ class ContactController extends Controller public function store(Request $request) { $requestContact = $request->validate([ - "idk kev" => "required|max:255", - + "name_first" => "required|max:255", + "name_last" => "required|max:255", + "email" => "required|max:255", + "tel" => "required|max:255", ]); $contact = new MenuPlan($requestContact); From 86bf8cbc6ed79fd1d9ebcc4d8bc7437b9a3d0816 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 10:37:42 +0200 Subject: [PATCH 05/25] Contact frontend --- skolehjem/resources/views/admin/layout/base.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index c5eecc5..2b9b9b6 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -43,10 +43,10 @@ <div class="segment"> <h3 class="text-white">Kontakter</h3> <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("contact.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Kontakter</a> </div> <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("contact.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a> </div> </div> </div> From e8f13d81ec653ca301b5e06413b12ac38abdd0dd Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 10:40:34 +0200 Subject: [PATCH 06/25] Contact frontend --- .../views/admin/{contact => contacts}/create.blade.php | 0 .../views/admin/{contact => contacts}/index.blade.php | 0 skolehjem/resources/views/admin/layout/base.blade.php | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename skolehjem/resources/views/admin/{contact => contacts}/create.blade.php (100%) rename skolehjem/resources/views/admin/{contact => contacts}/index.blade.php (100%) diff --git a/skolehjem/resources/views/admin/contact/create.blade.php b/skolehjem/resources/views/admin/contacts/create.blade.php similarity index 100% rename from skolehjem/resources/views/admin/contact/create.blade.php rename to skolehjem/resources/views/admin/contacts/create.blade.php diff --git a/skolehjem/resources/views/admin/contact/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php similarity index 100% rename from skolehjem/resources/views/admin/contact/index.blade.php rename to skolehjem/resources/views/admin/contacts/index.blade.php diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index 2b9b9b6..c5eecc5 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -43,10 +43,10 @@ <div class="segment"> <h3 class="text-white">Kontakter</h3> <div class="row"> - <a href="{{ route("contact.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Kontakter</a> + <a href="{{ route("contacts.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Kontakter</a> </div> <div class="row"> - <a href="{{ route("contact.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a> + <a href="{{ route("contacts.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a> </div> </div> </div> From f952ad33aa996c8722505bc9f5469a397e1b6fb4 Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 10:41:27 +0200 Subject: [PATCH 07/25] Added s til controller --- skolehjem/app/Http/Controllers/ContactController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index c899c69..399a899 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -18,7 +18,7 @@ class ContactController extends Controller $contact = Contact::query()->paginate($request->input("limit", 20)); - return Response::detect("contact.index", [ "contact" => $contact]); + return Response::detect("contacts.index", [ "contact" => $contact]); } /** @@ -28,7 +28,7 @@ class ContactController extends Controller */ public function create() { - return Response::detect("contact.create"); + return Response::detect("contacts.create"); } @@ -47,7 +47,7 @@ class ContactController extends Controller "tel" => "required|max:255", ]); - $contact = new MenuPlan($requestContact); + $contact = new Contact($requestContact); $contact->save(); return Response::detect("contacts.store"); From 246ae2235d52e0d3664f1bb45431f7f3ed889591 Mon Sep 17 00:00:00 2001 From: Anders <anders164a@gmail.com> Date: Mon, 29 Jun 2020 10:46:28 +0200 Subject: [PATCH 08/25] =?UTF-8?q?Removed=20Fredag-S=C3=B8ndag=20on=20menup?= =?UTF-8?q?lan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skolehjem/resources/views/admin/menuplans/create.blade.php | 6 ------ skolehjem/resources/views/admin/menuplans/edit.blade.php | 6 ------ skolehjem/resources/views/admin/menuplans/index.blade.php | 6 ------ skolehjem/resources/views/admin/menuplans/show.blade.php | 6 ------ 4 files changed, 24 deletions(-) diff --git a/skolehjem/resources/views/admin/menuplans/create.blade.php b/skolehjem/resources/views/admin/menuplans/create.blade.php index fab76ef..04c6ef5 100644 --- a/skolehjem/resources/views/admin/menuplans/create.blade.php +++ b/skolehjem/resources/views/admin/menuplans/create.blade.php @@ -21,12 +21,6 @@ <input type="text" name="wednesday" id="wednesday" required> <label for="thursday">Torsdag:</label> <input type="text" name="thursday" id="thursday" required> - <label for="friday">Fredag:</label> - <input type="text" name="friday" id="friday" required> - <label for="saturday">Lørdag:</label> - <input type="text" name="saturday" id="saturday" required> - <label for="sunday">Søndag:</label> - <input type="text" name="sunday" id="sunday" required> <input type="submit" class="btn btn-dark text-white" value="Opret Menuplan"> </form> diff --git a/skolehjem/resources/views/admin/menuplans/edit.blade.php b/skolehjem/resources/views/admin/menuplans/edit.blade.php index 97cf74b..a8a8cc3 100644 --- a/skolehjem/resources/views/admin/menuplans/edit.blade.php +++ b/skolehjem/resources/views/admin/menuplans/edit.blade.php @@ -22,12 +22,6 @@ <input type="text" name="wednesday" id="onsdag" value="{{ $menuplan->wednesday }}" required> <label for="torsdag">Torsdag:</label> <input type="text" name="thursday" id="torsdag" value="{{ $menuplan->thursday }}" required> - <label for="fredag">Fredag:</label> - <input type="text" name="friday" id="fredag" value="{{ $menuplan->friday }}" required> - <label for="lørdag">Lørdag:</label> - <input type="text" name="saturday" id="lørdag" value="{{ $menuplan->saturday }}" required> - <label for="søndag">Søndag:</label> - <input type="text" name="sunday" id="søndag" value="{{ $menuplan->sunday }}" required> <input type="submit" class="btn btn-dark text-white" value="Opret Menuplan"> </form> diff --git a/skolehjem/resources/views/admin/menuplans/index.blade.php b/skolehjem/resources/views/admin/menuplans/index.blade.php index c42d8e0..e165a9b 100644 --- a/skolehjem/resources/views/admin/menuplans/index.blade.php +++ b/skolehjem/resources/views/admin/menuplans/index.blade.php @@ -16,9 +16,6 @@ <th>Tirsdag</th> <th>Onsdag</th> <th>Torsdag</th> - <th>Fredag</th> - <th>Lørdag</th> - <th>Søndag</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> @@ -28,9 +25,6 @@ <td>{{$menuplan->tuesday}}</td> <td>{{$menuplan->wednesday}}</td> <td>{{$menuplan->thursday}}</td> - <td>{{$menuplan->friday}}</td> - <td>{{$menuplan->saturday}}</td> - <td>{{$menuplan->sunday}}</td> <td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td> <form method="post" action="{{ route("menu-plans.destroy", [ "menu_plan" => $menuplan ]) }}" class="w-100"> diff --git a/skolehjem/resources/views/admin/menuplans/show.blade.php b/skolehjem/resources/views/admin/menuplans/show.blade.php index 5a8b198..fb7f9ab 100644 --- a/skolehjem/resources/views/admin/menuplans/show.blade.php +++ b/skolehjem/resources/views/admin/menuplans/show.blade.php @@ -16,9 +16,6 @@ <th>Tirsdag</th> <th>Onsdag</th> <th>Torsdag</th> - <th>Fredag</th> - <th>Lørdag</th> - <th>Søndag</th> <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> </tr> @@ -27,9 +24,6 @@ <td>{Tirsdag}</td> <td>{Onsdag}</td> <td>{Torsdag}</td> - <td>{Fredag}</td> - <td>{Lørdag}</td> - <td>{Søndag}</td> <td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> </tr> From 0f93f4ca979e294c86ae979db615fc22bb46b091 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 10:50:04 +0200 Subject: [PATCH 09/25] Fixes --- .../views/admin/menuplans/create.blade.php | 14 +++++------ .../admin/washing-machines/create.blade.php | 23 +------------------ 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/skolehjem/resources/views/admin/menuplans/create.blade.php b/skolehjem/resources/views/admin/menuplans/create.blade.php index fab76ef..30f8f0d 100644 --- a/skolehjem/resources/views/admin/menuplans/create.blade.php +++ b/skolehjem/resources/views/admin/menuplans/create.blade.php @@ -14,19 +14,19 @@ <form action="{{ action('MenuPlanController@store') }}" method="post"> @csrf <label for="monday">Mandag:</label> - <input type="text" name="monday" id="monday" required> + <input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required> <label for="tuesday">Tirsdag:</label> - <input type="text" name="tuesday" id="tuesday" required> + <input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required> <label for="wednesday">Onsdag:</label> - <input type="text" name="wednesday" id="wednesday" required> + <input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required> <label for="thursday">Torsdag:</label> - <input type="text" name="thursday" id="thursday" required> + <input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required> <label for="friday">Fredag:</label> - <input type="text" name="friday" id="friday" required> + <input type="text" name="friday" id="friday" placeholder="Tarteletter" required> <label for="saturday">Lørdag:</label> - <input type="text" name="saturday" id="saturday" required> + <input type="text" name="saturday" id="saturday" placeholder="Boller i karry" required> <label for="sunday">Søndag:</label> - <input type="text" name="sunday" id="sunday" required> + <input type="text" name="sunday" id="sunday" placeholder="Lasagne" required> <input type="submit" class="btn btn-dark text-white" value="Opret Menuplan"> </form> diff --git a/skolehjem/resources/views/admin/washing-machines/create.blade.php b/skolehjem/resources/views/admin/washing-machines/create.blade.php index b8915bb..c81e7c9 100644 --- a/skolehjem/resources/views/admin/washing-machines/create.blade.php +++ b/skolehjem/resources/views/admin/washing-machines/create.blade.php @@ -14,28 +14,7 @@ <form method="post" action="{{ route("washing-machines.store") }}"> @csrf <label for="name_first">Vaskemaskine Navn:</label> - <input type="text" name="name" id="name" max="60" required> + <input type="text" name="name" id="name" max="60" placeholder="Vaskemaskine nr. 1" required> <input type="submit" class="btn btn-dark text-white" value="Opret"> </form> - -{{-- <table class="tbl">--}} -{{-- <tr>--}} -{{-- <th>ID</th>--}} -{{-- <th>Fornavn</th>--}} -{{-- <th>Efternavn</th>--}} -{{-- <th>Email</th>--}} -{{-- <th>Tlf nr</th>--}} -{{-- <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>--}} -{{-- <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>--}} -{{-- </tr>--}} -{{-- <tr>--}} -{{-- <td>{ID}</td>--}} -{{-- <td>{Fornavn}</td>--}} -{{-- <td>{Efternavn}</td>--}} -{{-- <td>{Email}</td>--}} -{{-- <td>{TLF}</td>--}} -{{-- <td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>--}} -{{-- <td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>--}} -{{-- </tr>--}} -{{-- </table>--}} @endsection From 469c21645acaf819a0135f56c74e92d64933d82d Mon Sep 17 00:00:00 2001 From: Anders <anders164a@gmail.com> Date: Mon, 29 Jun 2020 10:56:53 +0200 Subject: [PATCH 10/25] Added Event route in admins left navbar --- skolehjem/resources/views/admin/layout/base.blade.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index c5eecc5..e9ee9cb 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -28,6 +28,15 @@ <a href="{{ route("menu-plans.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Menuplan</a> </div> </div> + <div class="segment"> + <h3 class="text-white">Aktiviteter</h3> + <div class="row"> + <a href="{{ route("events.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Aktiviteter</a> + </div> + <div class="row"> + <a href="{{ route("events.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Aktivitet</a> + </div> + </div> <div class="segment"> <h3 class="text-white">Vaskemaskiner</h3> <div class="row"> From 02faa63b98f609589d8ef8d11e9dcf3c6133bf0c Mon Sep 17 00:00:00 2001 From: Anders <anders164a@gmail.com> Date: Mon, 29 Jun 2020 11:09:39 +0200 Subject: [PATCH 11/25] =?UTF-8?q?Removed=20Fredag-S=C3=B8ndag=20in=20menup?= =?UTF-8?q?lans?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/views/app/menuplans/index.blade.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/skolehjem/resources/views/app/menuplans/index.blade.php b/skolehjem/resources/views/app/menuplans/index.blade.php index cbd4249..f66d484 100644 --- a/skolehjem/resources/views/app/menuplans/index.blade.php +++ b/skolehjem/resources/views/app/menuplans/index.blade.php @@ -25,18 +25,6 @@ <h3 class="sde-blue bold text-center">Torsdag</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> </div> - <div class="w-100" id="fredag"> - <h3 class="sde-blue bold text-center">Fredag</h3> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> - </div> - <div class="w-100" id="lørdag"> - <h3 class="sde-blue bold text-center">Lørdag</h3> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> - </div> - <div class="w-100" id="søndag"> - <h3 class="sde-blue bold text-center">Søndag</h3> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> - </div> </div> </main> @endsection From ba7344004410088ae5676bbd3edc87071dc60c9d Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 11:14:07 +0200 Subject: [PATCH 12/25] =?UTF-8?q?Lavet=20s=C3=A5dan=20at=20man=20kan=20add?= =?UTF-8?q?e=20information=20til=20contacts=20databasen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skolehjem/app/Contact.php | 2 +- skolehjem/app/Http/Controllers/ContactController.php | 2 +- .../migrations/2020_06_29_065007_create_contact.php | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/skolehjem/app/Contact.php b/skolehjem/app/Contact.php index 74d306b..353a325 100644 --- a/skolehjem/app/Contact.php +++ b/skolehjem/app/Contact.php @@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; class Contact extends Model { protected $fillable = [ - 'name_first', "name_last", 'email', 'tel' + 'name_first', "name_last", 'email', 'phone' ]; } diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 399a899..96cae3e 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -44,7 +44,7 @@ class ContactController extends Controller "name_first" => "required|max:255", "name_last" => "required|max:255", "email" => "required|max:255", - "tel" => "required|max:255", + "phone" => "required|max:255", ]); $contact = new Contact($requestContact); diff --git a/skolehjem/database/migrations/2020_06_29_065007_create_contact.php b/skolehjem/database/migrations/2020_06_29_065007_create_contact.php index 01a3235..233c7e3 100644 --- a/skolehjem/database/migrations/2020_06_29_065007_create_contact.php +++ b/skolehjem/database/migrations/2020_06_29_065007_create_contact.php @@ -13,9 +13,14 @@ class CreateContact extends Migration */ public function up() { - Schema::create('contact', function (Blueprint $table) { + Schema::create('contacts', function (Blueprint $table) { $table->id(); $table->timestamps(); + $table->string('name_first', 255); + $table->string('name_last', 255); + $table->string('email', 255); + $table->integer('phone'); + //$table->unique('email'); }); } From b198f830c3a3983fe2f6664e0e0d554997f136be Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 11:34:21 +0200 Subject: [PATCH 13/25] Kontakt frontend --- .../views/admin/contacts/edit.blade.php | 27 +++++++++++++++++++ .../views/admin/contacts/store.blade.php | 14 ++++++++++ .../views/admin/contacts/update.blade.php | 14 ++++++++++ 3 files changed, 55 insertions(+) create mode 100644 skolehjem/resources/views/admin/contacts/edit.blade.php create mode 100644 skolehjem/resources/views/admin/contacts/store.blade.php create mode 100644 skolehjem/resources/views/admin/contacts/update.blade.php diff --git a/skolehjem/resources/views/admin/contacts/edit.blade.php b/skolehjem/resources/views/admin/contacts/edit.blade.php new file mode 100644 index 0000000..5167abf --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/edit.blade.php @@ -0,0 +1,27 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakt - Rediger +@endsection + +@section("path") + <a href="{{ route('contacts.edit', ['contact' => $contact]) }}" class="text-white">Rediger Kontakt</a> / +@endsection + +@section("content") + <h1>Rediger Kontakt:</h1> + <form method="post" action="{{ route("contacts.update", ['contact' => $contact]) }}"> + @csrf + @method("put") + <label for="name_first">Fornavn:</label> + <input type="text" name="name_first" id="name_first" placeholder="Fornavn" value="{{ $contact->name_first }}" required> + <label for="name_last">Efternavn:</label> + <input type="text" name="name_last" id="name_last" placeholder="Efternavn" value="{{ $contact->name_last }}" required> + <label for="email">Email:</label> + <input type="email" name="email" id="email" placeholder="x@y.z" value="{{ $contact->email }}" required> + <label for="tel">Telefon nr:</label> + <input type="tel" name="phone" id="tel" placeholder="12345678" value="{{ $contact->phone }}" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required> + <input type="submit" class="btn btn-dark text-white" value="Opret"> + </form> +@endsection diff --git a/skolehjem/resources/views/admin/contacts/store.blade.php b/skolehjem/resources/views/admin/contacts/store.blade.php new file mode 100644 index 0000000..d6adde7 --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/store.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakter - Opret +@endsection + +@section("path") + <a href="" class="text-white">Opbevar Kontakt</a> / +@endsection + +@section("content") + Kontakten blev (ikke) oprettet. +@endsection diff --git a/skolehjem/resources/views/admin/contacts/update.blade.php b/skolehjem/resources/views/admin/contacts/update.blade.php new file mode 100644 index 0000000..b02c301 --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/update.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakt - Rediger +@endsection + +@section("path") + <a href="{{ route('contacts.edit') }}" class="text-white">Rediger Bruger</a> / +@endsection + +@section("content") + Kontakten blev (ikke) redigeret. +@endsection From ad0f61dd51bd21c655e83c3fc7d9c59fa1dca5e4 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 11:38:18 +0200 Subject: [PATCH 14/25] Kontakt frontend --- skolehjem/resources/views/admin/contacts/index.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php index da92e7e..05353bf 100644 --- a/skolehjem/resources/views/admin/contacts/index.blade.php +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -21,8 +21,8 @@ </tr> @foreach($contacts as $contact) <tr> - <td>{{ $contact->name }}</td> - <td>{{ $contact->title }}</td> + <td>{{ $contact->name_first }}</td> + <td>{{ $contact->name_last }}</td> <td>{{ $contact->email }}</td> <td>{{ $contact->phone }}</td> <td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> From c86c067d07e6fb2e1ab6164c9b6345fbd74e02d6 Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 11:39:00 +0200 Subject: [PATCH 15/25] added s to the end of contacts --- skolehjem/app/Http/Controllers/ContactController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 96cae3e..3e0213f 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -18,7 +18,7 @@ class ContactController extends Controller $contact = Contact::query()->paginate($request->input("limit", 20)); - return Response::detect("contacts.index", [ "contact" => $contact]); + return Response::detect("contacts.index", [ "contacts" => $contact]); } /** From 137c12cbeecebc022ee96ab2f65d3e8cdd889ab6 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 11:41:33 +0200 Subject: [PATCH 16/25] Kontakt frontend --- skolehjem/resources/views/admin/contacts/index.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php index 05353bf..f277ce0 100644 --- a/skolehjem/resources/views/admin/contacts/index.blade.php +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -25,8 +25,8 @@ <td>{{ $contact->name_last }}</td> <td>{{ $contact->email }}</td> <td>{{ $contact->phone }}</td> - <td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> - <td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> + <td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> + <td><a href="{{ route("contacts.delete", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> </tr> @endforeach </table> From a0a6f1a9cbf4dc9d6c8c4fc291bf02157a2408ee Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 11:48:36 +0200 Subject: [PATCH 17/25] Laver edit, show, update,delete controller for contacts --- .../Http/Controllers/ContactController.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 3e0213f..6a64f05 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -61,7 +61,8 @@ class ContactController extends Controller */ public function show($id) { - // + return Response::detect("contacts.show", [ "contacts" => $id]); + } /** @@ -72,7 +73,8 @@ class ContactController extends Controller */ public function edit($id) { - // + $contacts = Contact::find($id); + return Response::detect("contacts.edit", ["contact" => $contacts]); } /** @@ -84,7 +86,15 @@ class ContactController extends Controller */ public function update(Request $request, $id) { - // + + $data = $request->all(); + //FORCED UPDATE + + $contact = Contact::find($id); + $contact->update($data); + $contact->save(); + + return Response::detect("contacts.update", [ "contact" => $contact ]); } /** @@ -95,6 +105,9 @@ class ContactController extends Controller */ public function destroy($id) { - // + + $contact = Contact::find($id); + $contact->delete(); + return redirect()->route("contacts.index"); } } From f5cdf848a37df3c8dd51d9cc2bec8efcfeb062df Mon Sep 17 00:00:00 2001 From: Anders <anders164a@gmail.com> Date: Mon, 29 Jun 2020 11:57:11 +0200 Subject: [PATCH 18/25] Added Staff section and routing + some backend (That should be checked out) --- .../app/Http/Controllers/StaffController.php | 203 ++++++++++++++++++ skolehjem/app/Staff.php | 10 + .../views/admin/staff/create.blade.php | 30 +++ .../views/admin/staff/delete.blade.php | 13 ++ .../views/admin/staff/edit.blade.php | 31 +++ .../views/admin/staff/index.blade.php | 42 ++++ .../views/admin/staff/login.blade.php | 27 +++ .../views/admin/staff/logout.blade.php | 14 ++ .../views/admin/staff/show.blade.php | 14 ++ .../views/admin/staff/store.blade.php | 14 ++ .../views/admin/staff/update.blade.php | 14 ++ skolehjem/routes/web.php | 1 + 12 files changed, 413 insertions(+) create mode 100644 skolehjem/app/Http/Controllers/StaffController.php create mode 100644 skolehjem/app/Staff.php create mode 100644 skolehjem/resources/views/admin/staff/create.blade.php create mode 100644 skolehjem/resources/views/admin/staff/delete.blade.php create mode 100644 skolehjem/resources/views/admin/staff/edit.blade.php create mode 100644 skolehjem/resources/views/admin/staff/index.blade.php create mode 100644 skolehjem/resources/views/admin/staff/login.blade.php create mode 100644 skolehjem/resources/views/admin/staff/logout.blade.php create mode 100644 skolehjem/resources/views/admin/staff/show.blade.php create mode 100644 skolehjem/resources/views/admin/staff/store.blade.php create mode 100644 skolehjem/resources/views/admin/staff/update.blade.php diff --git a/skolehjem/app/Http/Controllers/StaffController.php b/skolehjem/app/Http/Controllers/StaffController.php new file mode 100644 index 0000000..38b2821 --- /dev/null +++ b/skolehjem/app/Http/Controllers/StaffController.php @@ -0,0 +1,203 @@ +<?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:user.list", "role:admin" ])->only("index"); +// $this->middleware([ "permission:user.show", "role:admin" ])->only("show"); +// $this->middleware([ "permission:user.edit", "role:admin" ])->only([ "edit", "update" ]); +// $this->middleware([ "permission:user.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) + { + $staff = Staff::query()->paginate($request->query("page", 20)); + + return Response::detect("staff.index", [ "staff" => $staff ]); + } + + /** + * 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) + { + Log::debug("STORE FUNCTION"); + + $data = $request->validate([ + "name_first" => "required|max:255", + "name_last" => "required|max:255", + "email" => "required|email|unique:users", + "password" => "required|max:60", + "phone" => "required|unique:users", + + ]); + + Log::debug("FINISHED VALIDATION?"); + + $staff = new Staff($data); + + Log::debug("CREATED USER [NOT PERSISTED YET]"); + + $staff->save(); + + Log::debug("SAVED STAFF"); + + return view("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:users", +// "password" => "max:60", +// "phone" => "unique:users", +// ]); + + // Validates if the user is updating itself or another user. +// if($id === Auth::id()) { +// $user = Auth::user(); +// +// $user->update($data); +// +// $user->save(); +// return Response::detect("users.edit", [ +// "user" => $user +// ]); +// } + + //TODO: Implement when security's ready!!! +// else if(Auth::user()->hasPermissionTo("user.edit")) { + $staff = Staff::find($id); + + /** @var Staff $staff */ + $staff->update($data); + + $staff->save(); +// } + + $staffs = Staff::query()->paginate(20); + + return Response::detect("users.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($id) + { +// if($id === Auth::id()) { +// $user = Auth::user(); +// $user->delete(); +// } +// else if(Auth::user()->hasPermissionTo("user.delete")) { + $staff = Staff::find($id); + + $staff->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("/"); + } +} diff --git a/skolehjem/app/Staff.php b/skolehjem/app/Staff.php new file mode 100644 index 0000000..23fc501 --- /dev/null +++ b/skolehjem/app/Staff.php @@ -0,0 +1,10 @@ +<?php + +namespace App; + +use Illuminate\Database\Eloquent\Model; + +class Staff extends Model +{ + // +} diff --git a/skolehjem/resources/views/admin/staff/create.blade.php b/skolehjem/resources/views/admin/staff/create.blade.php new file mode 100644 index 0000000..3430725 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/create.blade.php @@ -0,0 +1,30 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Opret +@endsection + +@section("path") + <a href="{{ route('staff.create') }}" class="text-white">Opret Personal</a> / +@endsection + +@section("content") + <h1>Opret Personal:</h1> + <form method="post" action="{{ route("staff.store") }}"> + @csrf + <label for="name_first">Fornavn:</label> + <input type="text" name="name_first" id="name_first" placeholder="Fornavn" required> + <label for="name_last">Efternavn:</label> + <input type="text" name="name_last" id="name_last" placeholder="Efternavn" required> + <label for="email">Email:</label> + <input type="email" name="email" id="email" placeholder="x@y.z" required> + <label for="password1">Password:</label> + <input type="password" name="password" placeholder="Password" id="password1" required> + <label for="password2">Bekræft Password:</label> + <input type="password" id="password2" placeholder="Bekræft Password" required> + <label for="tel">Telefon nr:</label> + <input type="tel" name="phone" id="tel" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required> + <input type="submit" class="btn btn-dark text-white" value="Opret"> + </form> +@endsection diff --git a/skolehjem/resources/views/admin/staff/delete.blade.php b/skolehjem/resources/views/admin/staff/delete.blade.php new file mode 100644 index 0000000..4c3f81e --- /dev/null +++ b/skolehjem/resources/views/admin/staff/delete.blade.php @@ -0,0 +1,13 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Fjern +@endsection + +@section("path") + <a href="{{ route('staff.delete') }}" class="text-white">Fjern Personal</a> / +@endsection + +@section("content") +@endsection diff --git a/skolehjem/resources/views/admin/staff/edit.blade.php b/skolehjem/resources/views/admin/staff/edit.blade.php new file mode 100644 index 0000000..fe8271d --- /dev/null +++ b/skolehjem/resources/views/admin/staff/edit.blade.php @@ -0,0 +1,31 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Rediger +@endsection + +@section("path") + <a href="{{ route('staff.edit', ['staff' => $staff]) }}" class="text-white">Rediger Personal</a> / +@endsection + +@section("content") + <h1>Rediger Personal:</h1> + <form method="post" action="{{ route("staff.update", ['staff' => $staff]) }}"> + @csrf + @method("put") + <label for="name_first">Fornavn:</label> + <input type="text" name="name_first" id="name_first" value="{{ $staff->name_first }}" required> + <label for="name_last">Efternavn:</label> + <input type="text" name="name_last" id="name_last" value="{{ $staff->name_last }}" required> + <label for="email">Email:</label> + <input type="email" name="email" id="email" value="{{ $staff->name_email }}" required> + <label for="password1">Password:</label> + <input type="password" name="password" id="password1" value="" required> + <label for="password2">Confirm Password:</label> + <input type="password" id="password2" value="" required> + <label for="tel">Telefon nr:</label> + <input type="tel" name="phone" id="tel" value="{{ $staff->phone }}" required> + <input type="submit" class="btn btn-dark text-white" value="Rediger"> + </form> +@endsection diff --git a/skolehjem/resources/views/admin/staff/index.blade.php b/skolehjem/resources/views/admin/staff/index.blade.php new file mode 100644 index 0000000..e206090 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/index.blade.php @@ -0,0 +1,42 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Vis +@endsection + +@section("path") + <a href="{{ route('staff.index') }}" class="text-white">Vis Personal</a> / +@endsection + +@section("content") + <table class="tbl"> + <tr> + <th>Fornavn</th> + <th>Efternavn</th> + <th>Email</th> + <th>Tlf nr</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($staffs as $staff) + <tr> + <td>{{ $staff->name_first }}</td> + <td>{{ $staff->name_last }}</td> + <td>{{ $staff->email }}</td> + <td>{{ $staff->phone }}</td> + <td><a href="{{ route("users.edit", [ "staff" => $staff->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> + <td> + <form method="post" action="{{ route("users.destroy", [ "staff" => $staff ]) }}" class="w-100"> + @csrf + @method("delete") + + <button type="submit"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> + </form> + </td> + </tr> + @endforeach + </table> + + {{ $staff->links() }} +@endsection diff --git a/skolehjem/resources/views/admin/staff/login.blade.php b/skolehjem/resources/views/admin/staff/login.blade.php new file mode 100644 index 0000000..5accdac --- /dev/null +++ b/skolehjem/resources/views/admin/staff/login.blade.php @@ -0,0 +1,27 @@ +@extends("app.layout.base") + +@section("title") + Login +@endsection + +@section("content") + <main style="background-color: #00788a; height: 100%;"> + <div class="brand"> + <img src="{{URL::asset('/images/logos/Logo-hvid.svg')}}" alt="Syddansk Erhvervsskole"> + </div> + <form action="" method="post"> + @csrf + <input class="appinput" type="email" name="email" placeholder="Email" required> + <input class="appinput" type="password" name="password" placeholder="Password" required> + <label class="toggle"> + <input class="toggle__input" type="checkbox" name="rememberpassword"> + <span class="toggle__label"> + <span class="toggle__text text-white">Remember password</span> + </span> + </label> + <input class="btn btn-dark" type="submit" value="Sign in"> + <button class="btn" onclick="window.location = '';">Sign up</button> + </form> + <a class="text-white text-center" href="">Forgot password?</a> + </main> +@endsection diff --git a/skolehjem/resources/views/admin/staff/logout.blade.php b/skolehjem/resources/views/admin/staff/logout.blade.php new file mode 100644 index 0000000..d364bbd --- /dev/null +++ b/skolehjem/resources/views/admin/staff/logout.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Home - Logud +@endsection + +@section("path") + <a href="{{ route('staff.logout') }}" class="text-white">Logud</a> / +@endsection + +@section("content") + +@endsection diff --git a/skolehjem/resources/views/admin/staff/show.blade.php b/skolehjem/resources/views/admin/staff/show.blade.php new file mode 100644 index 0000000..5563064 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/show.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Vis +@endsection + +@section("path") + <a href="{{ route('staff.index') }}" class="text-white">Vis Personal</a> / +@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 new file mode 100644 index 0000000..43ae210 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/store.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Opret +@endsection + +@section("path") + <a href="{{ route('staff.create') }}" class="text-white">Opret Personal</a> / +@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 new file mode 100644 index 0000000..7f7a25f --- /dev/null +++ b/skolehjem/resources/views/admin/staff/update.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Rediger +@endsection + +@section("path") + <a href="{{ route('staff.edit') }}" class="text-white">Rediger Personal</a> / +@endsection + +@section("content") + Din Personal blev (ikke) redigeret. +@endsection diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index 260a3f8..ef7c2dd 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -29,6 +29,7 @@ Route::get("/logout", "UserController@logout")->name("users.logout"); Route::resource("contacts", "ContactController"); Route::resource("menu-plans", "MenuPlanController"); Route::resource("users", "UserController"); +Route::resource("staff", "StaffController"); Route::resource("events", "EventController"); Route::resource("washing-machines", "WashingMachineController"); Route::resource("washing-reservations", "WashingReservationController"); From 30b31e030970af9188e8b8bd7d692a9b9352aa48 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 12:20:09 +0200 Subject: [PATCH 19/25] Kontakt frontend --- .../views/admin/contacts/delete.blade.php | 14 ++++++++++++++ skolehjem/resources/views/app/root/index.blade.php | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 skolehjem/resources/views/admin/contacts/delete.blade.php diff --git a/skolehjem/resources/views/admin/contacts/delete.blade.php b/skolehjem/resources/views/admin/contacts/delete.blade.php new file mode 100644 index 0000000..b126821 --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/delete.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakter - Opret +@endsection + +@section("path") + <a href="" class="text-white">Slet Kontakt</a> / +@endsection + +@section("content") + Din kontakt blev slettet +@endsection diff --git a/skolehjem/resources/views/app/root/index.blade.php b/skolehjem/resources/views/app/root/index.blade.php index df2b1fe..1984f5d 100644 --- a/skolehjem/resources/views/app/root/index.blade.php +++ b/skolehjem/resources/views/app/root/index.blade.php @@ -21,11 +21,14 @@ {{--@extends("app.washing-reservations.index")--}} {{--Menuplan--}} -{{----}}@extends("app.menuplans.index") +{{--@extends("app.menuplans.index")--}} {{--Contact--}} {{--@extends("app.contact.index")--}} +{{--Account--}} +{{----}}@extends("app.users.index") + {{----}} {{------Admin Panel {{----}} From 3f5886223b3d963a29d32aa59ee774d78756059f Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 12:21:16 +0200 Subject: [PATCH 20/25] idk kev --- skolehjem/app/Http/Controllers/ContactController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 6a64f05..3792500 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -88,13 +88,11 @@ class ContactController extends Controller { $data = $request->all(); - //FORCED UPDATE - $contact = Contact::find($id); $contact->update($data); $contact->save(); - return Response::detect("contacts.update", [ "contact" => $contact ]); + return Response::detect("contacts.update", [ "contacts" => $contact ]); } /** From d37c0c63f63cd4a42bdb847460b62615505d471d Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 12:24:45 +0200 Subject: [PATCH 21/25] Kontakt frontend --- skolehjem/resources/views/admin/contacts/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php index f277ce0..36b034a 100644 --- a/skolehjem/resources/views/admin/contacts/index.blade.php +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -26,7 +26,7 @@ <td>{{ $contact->email }}</td> <td>{{ $contact->phone }}</td> <td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> - <td><a href="{{ route("contacts.delete", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> + <td><a href="{{ route("contacts.destroy", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> </tr> @endforeach </table> From 600bbe7746899d8ba08d770a456dac2abfd6ce42 Mon Sep 17 00:00:00 2001 From: Anders <anders164a@gmail.com> Date: Mon, 29 Jun 2020 12:29:23 +0200 Subject: [PATCH 22/25] Fixed routing and backend to staff section --- .../app/Http/Controllers/StaffController.php | 38 +++++++++---------- skolehjem/app/Staff.php | 37 +++++++++++++++++- .../views/admin/layout/base.blade.php | 9 +++++ .../views/admin/staff/index.blade.php | 6 +-- 4 files changed, 67 insertions(+), 23 deletions(-) diff --git a/skolehjem/app/Http/Controllers/StaffController.php b/skolehjem/app/Http/Controllers/StaffController.php index 38b2821..c5fbf78 100644 --- a/skolehjem/app/Http/Controllers/StaffController.php +++ b/skolehjem/app/Http/Controllers/StaffController.php @@ -16,10 +16,10 @@ class StaffController extends Controller // $this->middleware([ "auth" ])->only("logout"); // $this->middleware([ "guest" ])->only("login"); // -// $this->middleware([ "permission:user.list", "role:admin" ])->only("index"); -// $this->middleware([ "permission:user.show", "role:admin" ])->only("show"); -// $this->middleware([ "permission:user.edit", "role:admin" ])->only([ "edit", "update" ]); -// $this->middleware([ "permission:user.delete", "role:admin" ])->only("delete"); +// $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"); } /** @@ -30,9 +30,9 @@ class StaffController extends Controller */ public function index(Request $request) { - $staff = Staff::query()->paginate($request->query("page", 20)); + $staffs = Staff::query()->paginate($request->query("page", 20)); - return Response::detect("staff.index", [ "staff" => $staff ]); + return Response::detect("staff.index", [ "staffs" => $staffs ]); } /** @@ -58,9 +58,9 @@ class StaffController extends Controller $data = $request->validate([ "name_first" => "required|max:255", "name_last" => "required|max:255", - "email" => "required|email|unique:users", + "email" => "required|email|unique:staff", "password" => "required|max:60", - "phone" => "required|unique:users", + "phone" => "required|unique:staff", ]); @@ -68,7 +68,7 @@ class StaffController extends Controller $staff = new Staff($data); - Log::debug("CREATED USER [NOT PERSISTED YET]"); + Log::debug("CREATED STAFF [NOT PERSISTED YET]"); $staff->save(); @@ -121,25 +121,25 @@ class StaffController extends Controller // $data = $request->validate([ // "name_first" => "max:255", // "name_last" => "max:255", -// "email" => "email|unique:users", +// "email" => "email|unique:staff", // "password" => "max:60", -// "phone" => "unique:users", +// "phone" => "unique:staff", // ]); - // Validates if the user is updating itself or another user. + // Validates if the staff is updating itself or another staff. // if($id === Auth::id()) { -// $user = Auth::user(); +// $staff = Auth::staff(); // -// $user->update($data); +// $staff->update($data); // -// $user->save(); -// return Response::detect("users.edit", [ -// "user" => $user +// $staff->save(); +// return Response::detect("staff.edit", [ +// "staff" => $staff // ]); // } //TODO: Implement when security's ready!!! -// else if(Auth::user()->hasPermissionTo("user.edit")) { +// else if(Auth::staff()->hasPermissionTo("staff.edit")) { $staff = Staff::find($id); /** @var Staff $staff */ @@ -150,7 +150,7 @@ class StaffController extends Controller $staffs = Staff::query()->paginate(20); - return Response::detect("users.index", [ + return Response::detect("staff.index", [ "staffs" => $staffs ]); } diff --git a/skolehjem/app/Staff.php b/skolehjem/app/Staff.php index 23fc501..841134d 100644 --- a/skolehjem/app/Staff.php +++ b/skolehjem/app/Staff.php @@ -3,8 +3,43 @@ 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); + } } diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index e9ee9cb..e3398e2 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -58,6 +58,15 @@ <a href="{{ route("contacts.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</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 class="w-85" style="background-color: #cccccc;"> <div class="directorypath text-white"> diff --git a/skolehjem/resources/views/admin/staff/index.blade.php b/skolehjem/resources/views/admin/staff/index.blade.php index e206090..88f80ff 100644 --- a/skolehjem/resources/views/admin/staff/index.blade.php +++ b/skolehjem/resources/views/admin/staff/index.blade.php @@ -25,9 +25,9 @@ <td>{{ $staff->name_last }}</td> <td>{{ $staff->email }}</td> <td>{{ $staff->phone }}</td> - <td><a href="{{ route("users.edit", [ "staff" => $staff->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> + <td><a href="{{ route("staff.edit", [ "staff" => $staff->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td> - <form method="post" action="{{ route("users.destroy", [ "staff" => $staff ]) }}" class="w-100"> + <form method="post" action="{{ route("staff.destroy", [ "staff" => $staff ]) }}" class="w-100"> @csrf @method("delete") @@ -38,5 +38,5 @@ @endforeach </table> - {{ $staff->links() }} + {{ $staffs->links() }} @endsection From 7d80b014c742df0d404f9851e9f41591ada750e3 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 12:32:34 +0200 Subject: [PATCH 23/25] Kontakt frontend --- skolehjem/resources/views/admin/contacts/update.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skolehjem/resources/views/admin/contacts/update.blade.php b/skolehjem/resources/views/admin/contacts/update.blade.php index b02c301..5bcac64 100644 --- a/skolehjem/resources/views/admin/contacts/update.blade.php +++ b/skolehjem/resources/views/admin/contacts/update.blade.php @@ -6,7 +6,7 @@ @endsection @section("path") - <a href="{{ route('contacts.edit') }}" class="text-white">Rediger Bruger</a> / + <a href="{{ route('contacts.update') }}" class="text-white">Rediger Bruger</a> / @endsection @section("content") From 04ad9f6d1c2f9bdbc63964fdc871eb797782b192 Mon Sep 17 00:00:00 2001 From: frederikpyt <frederikpyt@gmail.com> Date: Mon, 29 Jun 2020 12:35:24 +0200 Subject: [PATCH 24/25] Kontakt frontend --- skolehjem/resources/views/admin/contacts/update.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skolehjem/resources/views/admin/contacts/update.blade.php b/skolehjem/resources/views/admin/contacts/update.blade.php index 5bcac64..f10aa0f 100644 --- a/skolehjem/resources/views/admin/contacts/update.blade.php +++ b/skolehjem/resources/views/admin/contacts/update.blade.php @@ -6,7 +6,7 @@ @endsection @section("path") - <a href="{{ route('contacts.update') }}" class="text-white">Rediger Bruger</a> / + <a href="{{ route('contacts.update', ["contact" => $contact]) }}" class="text-white">Rediger Bruger</a> / @endsection @section("content") From f61f67d0bc0c6660409759217ddcce5486ba1d35 Mon Sep 17 00:00:00 2001 From: Neerholt <vict3459@edu.sde.dk> Date: Mon, 29 Jun 2020 12:36:07 +0200 Subject: [PATCH 25/25] slette s --- skolehjem/app/Http/Controllers/ContactController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 3792500..2fb0e54 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -73,8 +73,8 @@ class ContactController extends Controller */ public function edit($id) { - $contacts = Contact::find($id); - return Response::detect("contacts.edit", ["contact" => $contacts]); + $contact = Contact::find($id); + return Response::detect("contacts.edit", ["contact" => $contact]); } /**