v0.5.7 - Made multi language option

This commit is contained in:
2020-08-06 15:31:38 +02:00
parent 358e47b703
commit 7cc871ae90
26 changed files with 126 additions and 28 deletions
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -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.
*
@@ -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");
}
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -10,6 +10,7 @@ class RootController extends Controller
function __construct()
{
$this->middleware("auth");
$this->middleware([ "lang" ]);
}
public function index() {
@@ -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;
}
}
}
}
@@ -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.
*
@@ -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");
@@ -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");
+2 -1
View File
@@ -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
];
}