diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php
index e3e706c..204cbf9 100644
--- a/skolehjem/app/Http/Controllers/ContactController.php
+++ b/skolehjem/app/Http/Controllers/ContactController.php
@@ -13,6 +13,7 @@ class ContactController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:contact.list" ])->only("index");
$this->middleware([ "check.auth:contact.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/EventController.php b/skolehjem/app/Http/Controllers/EventController.php
index 1e80482..b99b08d 100644
--- a/skolehjem/app/Http/Controllers/EventController.php
+++ b/skolehjem/app/Http/Controllers/EventController.php
@@ -15,6 +15,7 @@ class EventController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:event.list" ])->only("index");
$this->middleware([ "check.auth:event.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/FeedbackController.php b/skolehjem/app/Http/Controllers/FeedbackController.php
index 5d39190..5bd25bc 100644
--- a/skolehjem/app/Http/Controllers/FeedbackController.php
+++ b/skolehjem/app/Http/Controllers/FeedbackController.php
@@ -13,6 +13,7 @@ class FeedbackController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:feedback.list" ])->only("index");
$this->middleware([ "check.auth:feedback.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/GuideController.php b/skolehjem/app/Http/Controllers/GuideController.php
index d38de56..65c18cb 100644
--- a/skolehjem/app/Http/Controllers/GuideController.php
+++ b/skolehjem/app/Http/Controllers/GuideController.php
@@ -13,6 +13,7 @@ class GuideController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:guides.list" ])->only("index");
$this->middleware([ "check.auth:guides.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/LocationController.php b/skolehjem/app/Http/Controllers/LocationController.php
index d766b01..d6100bf 100644
--- a/skolehjem/app/Http/Controllers/LocationController.php
+++ b/skolehjem/app/Http/Controllers/LocationController.php
@@ -11,6 +11,7 @@ class LocationController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:locations.list" ])->only("index");
$this->middleware([ "check.auth:locations.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/MenuPlanController.php b/skolehjem/app/Http/Controllers/MenuPlanController.php
index f10fc7b..6219089 100644
--- a/skolehjem/app/Http/Controllers/MenuPlanController.php
+++ b/skolehjem/app/Http/Controllers/MenuPlanController.php
@@ -17,6 +17,7 @@ class MenuPlanController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:menuplan.list" ])->only("index");
$this->middleware([ "check.auth:menuplan.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/PermissionController.php b/skolehjem/app/Http/Controllers/PermissionController.php
index 0b627f3..8d06041 100644
--- a/skolehjem/app/Http/Controllers/PermissionController.php
+++ b/skolehjem/app/Http/Controllers/PermissionController.php
@@ -8,6 +8,12 @@ use Spatie\Permission\Models\Permission;
class PermissionController extends Controller
{
+ public function __construct()
+ {
+ $this->middleware(["auth"]);
+ $this->middleware(["lang"]);
+ }
+
/**
* Display a listing of the resource.
*
diff --git a/skolehjem/app/Http/Controllers/PhoneController.php b/skolehjem/app/Http/Controllers/PhoneController.php
index e2c3466..6772654 100644
--- a/skolehjem/app/Http/Controllers/PhoneController.php
+++ b/skolehjem/app/Http/Controllers/PhoneController.php
@@ -7,6 +7,12 @@ use Illuminate\Http\Response;
class PhoneController extends Controller
{
+ public function __construct()
+ {
+ $this->middleware(["auth"]);
+ $this->middleware(["lang"]);
+ }
+
function index() {
return Response::detect("vagttelefons.index");
}
diff --git a/skolehjem/app/Http/Controllers/ResourceCategoryController.php b/skolehjem/app/Http/Controllers/ResourceCategoryController.php
index 657c6ec..dcfdb71 100644
--- a/skolehjem/app/Http/Controllers/ResourceCategoryController.php
+++ b/skolehjem/app/Http/Controllers/ResourceCategoryController.php
@@ -11,6 +11,7 @@ class ResourceCategoryController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:resource.category.list" ])->only("index");
$this->middleware([ "check.auth:resource.category.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/ResourceController.php b/skolehjem/app/Http/Controllers/ResourceController.php
index 7fe829d..20fe0ed 100644
--- a/skolehjem/app/Http/Controllers/ResourceController.php
+++ b/skolehjem/app/Http/Controllers/ResourceController.php
@@ -12,6 +12,7 @@ class ResourceController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:resource.list" ])->only("index");
$this->middleware([ "check.auth:resource.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/ResourceExtensionController.php b/skolehjem/app/Http/Controllers/ResourceExtensionController.php
index 422ecc5..b13606e 100644
--- a/skolehjem/app/Http/Controllers/ResourceExtensionController.php
+++ b/skolehjem/app/Http/Controllers/ResourceExtensionController.php
@@ -11,6 +11,7 @@ class ResourceExtensionController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:resource.extension.list" ])->only("index");
$this->middleware([ "check.auth:resource.extension.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/RolesController.php b/skolehjem/app/Http/Controllers/RolesController.php
index ae68be2..8997ffd 100644
--- a/skolehjem/app/Http/Controllers/RolesController.php
+++ b/skolehjem/app/Http/Controllers/RolesController.php
@@ -12,6 +12,7 @@ class rolesController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:roles.list" ])->only("index");
$this->middleware([ "check.auth:roles.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/RootController.php b/skolehjem/app/Http/Controllers/RootController.php
index d147e5b..28112ee 100644
--- a/skolehjem/app/Http/Controllers/RootController.php
+++ b/skolehjem/app/Http/Controllers/RootController.php
@@ -10,6 +10,7 @@ class RootController extends Controller
function __construct()
{
$this->middleware("auth");
+ $this->middleware([ "lang" ]);
}
public function index() {
diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php
index 13b09b8..50074f7 100644
--- a/skolehjem/app/Http/Controllers/UserController.php
+++ b/skolehjem/app/Http/Controllers/UserController.php
@@ -6,6 +6,7 @@ use App\Helpers\Detector;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\User;
+use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
@@ -20,6 +21,7 @@ class UserController extends Controller
{
$this->middleware([ "auth" ])->only("logout");
$this->middleware([ "guest" ])->only("login");
+ $this->middleware([ "lang" ])->except(["login", "showLogin"]);
$this->middleware([ "check.auth:user.list" ])->only("index");
$this->middleware([ "check.auth:user.show" ])->only("show");
@@ -462,4 +464,23 @@ class UserController extends Controller
return Response($output);
}
}
+
+
+
+ public function setLanguages(Request $request){
+ if($request->ajax()){
+ if($request->lang === "en"){
+ $response = new Response('Set Cookie');
+ $response->withCookie(cookie('languagesSetting', $request->lang, 5259488));
+
+ return $response;
+ }elseif($request->lang === "dk"){
+ $response = new Response('Set Cookie');
+ $response->withCookie(cookie('languagesSetting', $request->lang, 5259488));
+
+ return $response;
+ }
+ }
+ }
+
}
diff --git a/skolehjem/app/Http/Controllers/UserEventController.php b/skolehjem/app/Http/Controllers/UserEventController.php
index 4303acb..74e655b 100644
--- a/skolehjem/app/Http/Controllers/UserEventController.php
+++ b/skolehjem/app/Http/Controllers/UserEventController.php
@@ -8,6 +8,11 @@ use Illuminate\Http\Response;
class UserEventController extends Controller
{
+ public function __construct()
+ {
+ $this->middleware(["auth"]);
+ $this->middleware(["lang"]);
+ }
/**
* Update the specified resource in storage.
*
diff --git a/skolehjem/app/Http/Controllers/WashingMachineController.php b/skolehjem/app/Http/Controllers/WashingMachineController.php
index 9ef3096..d4e30f3 100644
--- a/skolehjem/app/Http/Controllers/WashingMachineController.php
+++ b/skolehjem/app/Http/Controllers/WashingMachineController.php
@@ -17,6 +17,7 @@ class WashingMachineController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:washing.machine.list" ])->only("index");
$this->middleware([ "check.auth:washing.machine.show" ])->only("show");
diff --git a/skolehjem/app/Http/Controllers/WashingReservationController.php b/skolehjem/app/Http/Controllers/WashingReservationController.php
index 4da0d9e..18d04b9 100644
--- a/skolehjem/app/Http/Controllers/WashingReservationController.php
+++ b/skolehjem/app/Http/Controllers/WashingReservationController.php
@@ -19,6 +19,7 @@ class WashingReservationController extends Controller
public function __construct()
{
$this->middleware([ "auth" ]);
+ $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:washing.machine.reservation.list" ])->only(["index", "appindex"]);
$this->middleware([ "check.auth:washing.machine.reservation.show" ])->only("show");
diff --git a/skolehjem/app/Http/Kernel.php b/skolehjem/app/Http/Kernel.php
index 3e1e21b..7b37d2d 100644
--- a/skolehjem/app/Http/Kernel.php
+++ b/skolehjem/app/Http/Kernel.php
@@ -2,6 +2,7 @@
namespace App\Http;
+use App\Http\Middleware\SetLocale;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
@@ -67,7 +68,7 @@ class Kernel extends HttpKernel
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
-
+ 'lang' => \App\Http\Middleware\SetLocale::class,
"check.auth" => \App\Http\Middleware\CheckAuth::class
];
}
diff --git a/skolehjem/app/User.php b/skolehjem/app/User.php
index 0db07bf..1f8aca1 100644
--- a/skolehjem/app/User.php
+++ b/skolehjem/app/User.php
@@ -7,6 +7,7 @@
namespace App;
//allows the use of many libraries.
+use http\Env\Request;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
@@ -52,4 +53,8 @@ class User extends Authenticatable
public function setPasswordAttribute($password) {
$this->attributes["password"] = Hash::make($password);
}
+
+ public function getLocale(\Illuminate\Http\Request $request) {
+ return $request->cookie('languagesSetting');
+ }
}
diff --git a/skolehjem/config/app.php b/skolehjem/config/app.php
index b7644e6..2c1b451 100644
--- a/skolehjem/config/app.php
+++ b/skolehjem/config/app.php
@@ -80,7 +80,7 @@ return [
|
*/
- 'locale' => 'en',
+ 'locale' => 'dk',
/*
|--------------------------------------------------------------------------
@@ -93,7 +93,7 @@ return [
|
*/
- 'fallback_locale' => 'en',
+ 'fallback_locale' => 'dk',
/*
|--------------------------------------------------------------------------
diff --git a/skolehjem/resources/views/app/events/index.blade.php b/skolehjem/resources/views/app/events/index.blade.php
index b38e477..2e328b7 100644
--- a/skolehjem/resources/views/app/events/index.blade.php
+++ b/skolehjem/resources/views/app/events/index.blade.php
@@ -5,7 +5,7 @@
@section("content")
- Aktiviteter
+ {{ __('msg.aktiviteter') }}
@if(!$events->isEmpty())
@foreach($events as $event)
@endforeach
@else
- Der er ingen aktiviteter!
+ {{__('msg.dereringenaktiviteter')}}!
@endif
- Se Tilmeldte Aktiviteter
+ {{__('msg.setilmeldteaktiviteter')}}
@endsection
diff --git a/skolehjem/resources/views/app/layout/base.blade.php b/skolehjem/resources/views/app/layout/base.blade.php
index 7d29a33..efb0573 100644
--- a/skolehjem/resources/views/app/layout/base.blade.php
+++ b/skolehjem/resources/views/app/layout/base.blade.php
@@ -20,15 +20,15 @@
- Menuplan
+ {{ __('msg.menuplan') }}
- Aktiviteter
+ {{ __('msg.aktiviteter') }}
- Reservationer
+ {{ __('msg.reservationer') }}
{{-- MÅ IKKE SLETTES!!!! --}}
{{-- --}}
@@ -37,23 +37,23 @@
{{-- --}}
- Kontoret
+ {{ __('msg.kontoret') }}
- Vagttelefon
+ {{ __('msg.vagttelefon') }}
- Vejledninger
+ {{ __('msg.vejledning') }}
- Konto
+ {{ __('msg.konto') }}
- Log Ud
+ {{ __('msg.logud') }}
diff --git a/skolehjem/resources/views/app/menuplans/index.blade.php b/skolehjem/resources/views/app/menuplans/index.blade.php
index 639ee20..8a620ae 100644
--- a/skolehjem/resources/views/app/menuplans/index.blade.php
+++ b/skolehjem/resources/views/app/menuplans/index.blade.php
@@ -11,31 +11,31 @@
@if($menuPlans->contains('week', $Week)) {{-- If any of the menues in the menu table has the number of the week in the 'week' column, do this --}}
@foreach($menuPlans as $menuplan)
@if($menuplan->week == $Week)
-
Menuplan
- Uge: {{$menuplan->week}}
+ {{ __('msg.menuplan') }}
+ {{ __('msg.uge') }}: {{$menuplan->week}}
-
Mandag
+
{{ __('msg.mandag') }}
{{$menuplan->monday}}
-
Tirsdag
+
{{ __('msg.tirsdag') }}
{{$menuplan->tuesday}}
-
Onsdag
+
{{ __('msg.onsdag') }}
{{$menuplan->wednesday}}
-
Torsdag
+
{{ __('msg.torsdag') }}
{{$menuplan->thursday}}
@endif
@endforeach
@else
- Menuplan
- Der er ingen menuplaner denne uge!
+ {{ __('msg.menuplan') }}
+ {{__('msg.dereringenmenuplanerdenneuge')}}!
@endif
{{ $menuPlans->links() }}
diff --git a/skolehjem/resources/views/app/users/account.blade.php b/skolehjem/resources/views/app/users/account.blade.php
index 1f420db..0d983be 100644
--- a/skolehjem/resources/views/app/users/account.blade.php
+++ b/skolehjem/resources/views/app/users/account.blade.php
@@ -5,6 +5,7 @@
@endsection
@section("content")
+
Konto
Navn: {{ Auth::user()->name_first . " " . Auth::user()->name_last }}
@@ -13,5 +14,43 @@
{!! session()->get('success#credentialschanged') !!}
Rediger Oplysninger
Ændre Password
+
+
+
+
+
+
+
+
@endsection
diff --git a/skolehjem/resources/views/app/users/index.blade.php b/skolehjem/resources/views/app/users/index.blade.php
index 256afe5..85379d2 100644
--- a/skolehjem/resources/views/app/users/index.blade.php
+++ b/skolehjem/resources/views/app/users/index.blade.php
@@ -3,12 +3,12 @@
@section('content')