-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0661f3
commit 454a363
Showing
43 changed files
with
679 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Website\Http\Controllers; | ||
|
||
use Inertia\Response; | ||
use Inertia\ResponseFactory; | ||
|
||
class ContactController extends Controller | ||
{ | ||
public function __invoke(ResponseFactory $factory): Response | ||
{ | ||
return $factory->render("Contact"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Website\Http\Controllers; | ||
|
||
use CodeZero\LocalizedRoutes\Controllers\FallbackController as OriginalFallbackController; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Redirect; | ||
use Illuminate\Support\Facades\Route; | ||
use Illuminate\Translation\Translator; | ||
|
||
class FallbackController extends OriginalFallbackController | ||
{ | ||
public function __construct( | ||
protected Translator $translator, | ||
protected Request $request, | ||
) {} | ||
|
||
protected function redirectResponse() | ||
{ | ||
if (!$this->shouldRedirect()) { | ||
return false; | ||
} | ||
|
||
$localizedUrl = Route::localizedUrl(); | ||
$route = $this->findRouteByUrl($localizedUrl); | ||
|
||
if ($route->isFallback) { | ||
return false; | ||
} | ||
|
||
return Redirect::to($route->uri(), $this->getRedirectStatusCode()) | ||
->header("Cache-Control", "no-store, no-cache, must-revalidate"); | ||
} | ||
|
||
protected function findRouteByUrl(string $url): \Illuminate\Routing\Route | ||
{ | ||
$parts = explode("/", $url); | ||
$path = implode("/", array_splice($parts, 4)); | ||
$url = $this->translator->uri($path); | ||
|
||
$domain = implode("/", array_splice($parts, -4)); | ||
|
||
return Route::getRoutes()->match(Request::create($domain . "/" . $url)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Website\Http\Controllers; | ||
|
||
use Inertia\Response; | ||
use Inertia\ResponseFactory; | ||
|
||
class HomeController extends Controller | ||
{ | ||
public function __invoke(ResponseFactory $factory): Response | ||
{ | ||
return $factory->render("Home"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Website\Http\Middleware; | ||
|
||
use Closure; | ||
use Illuminate\Http\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
class Localize | ||
{ | ||
public function handle(Request $request, Closure $next): Response | ||
{ | ||
if (str_starts_with($request->header("Accept-Language"), "pl")) { | ||
app()->setLocale("pl"); | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.