Add (routes): All routes possible

Add (pages): home country page
This commit is contained in:
2023-07-26 03:10:36 +08:00
parent 728fc09474
commit 36efe23dcc
24 changed files with 4125 additions and 51 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Str;
if (! function_exists('is_empty')) {
/**
* A better function to check if a value is empty or null. Strings, arrays, and Objects are supported.
@@ -35,3 +37,49 @@ function is_empty($value): bool
return false;
}
}
if (! function_exists('get_country_name_by_iso')) {
function get_country_name_by_iso($country_iso)
{
if (! is_empty($country_iso)) {
$country_iso = strtoupper($country_iso);
try {
return config("platform.country_codes.{$country_iso}")['name'];
}
catch (\Exception $e) {}
}
return 'International';
}
}
if (! function_exists('get_country_emoji_by_iso')) {
function get_country_emoji_by_iso($country_iso)
{
if (! is_empty($country_iso)) {
$country_iso = strtoupper($country_iso);
try {
return config("platform.country_codes.{$country_iso}")['emoji'];
}
catch (\Exception $e) {}
}
return '🌎';
}
}
if (! function_exists('str_random')) {
function str_random($length = 10)
{
return Str::random($length);
}
}

View File

@@ -7,23 +7,45 @@
use App\Models\CountryLocale;
use Illuminate\Http\Request;
use Stevebauman\Location\Facades\Location;
class HomeController extends Controller
{
public function index(Request $request)
{
return redirect()->route('home.country', ['country' => 'my']);
$country = strtolower($request->session()->get('country'));
return redirect()->route('home.country', ['country' => $country]);
}
public function country(Request $request, $country)
{
$country = CountryLocale::where('slug', $country)->first();
$country_locale = CountryLocale::where('slug', $country)->first();
if (! is_null($country)) {
$categories = Category::where('country_locale_id', $country->id)->get();
$categories = Category::where('country_locale_id', $country_locale->id)->get();
return view('front.country', ['categories' => $categories, 'country' => $country]);
$request->session()->put('view_country_locale', $country_locale);
return view('front.country', ['categories' => $categories, 'country_locale' => $country_locale]);
}
return redirect()->route('home.country', ['country' => 'my']);
return redirect()->route('home.country', ['country' => config('platform.general.fallback_country_slug')]);
}
public function countryCategory(Request $request, $country, $category)
{
return "{$country} : {$category}";
}
public function posts(Request $request, $country)
{
return "{$country} : all posts";
}
public function post(Request $request, $country, $post)
{
return "{$country} : {$post}";
}
}

View File

@@ -36,6 +36,7 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\StoreGeoSession::class,
],
'api' => [

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Stevebauman\Location\Facades\Location;
use Galahad\TimezoneMapper\Facades\TimezoneMapper;
class StoreGeoSession
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$needs_update = false;
$ip = get_current_ip();
$encoded_ip = base64_encode($ip);
if (! $request->session()->has('geokey')) {
if ($request->session()->get('geokey') != $encoded_ip) {
$request->session()->put('geokey', $encoded_ip);
$needs_update = true;
}
} else {
$request->session()->put('geokey', $encoded_ip);
$needs_update = true;
}
if (!$request->session()->has('timezone')) {
$needs_update = true;
}
if ($needs_update)
{
if ($payload = Location::get($ip))
{
$request->session()->put('geodata', base64_encode(json_encode($payload)));
$isocode = $payload->isoCode;
}
else
{
$isocode = '*';
}
$request->session()->put('country', $isocode);
if (isset($payload->latitude) && isset($payload->longitude))
{
$request->session()->put('timezone', TimezoneMapper::mapCoordinates($payload->latitude, $payload->longitude));
}
}
return $next($request);
}
}

View File

@@ -9,6 +9,7 @@
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
/**
* Class Category
@@ -30,7 +31,7 @@
*/
class Category extends Model
{
use SoftDeletes;
use SoftDeletes, Cachable;
protected $table = 'categories';

View File

@@ -9,6 +9,7 @@
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
/**
* Class CountryLocale
@@ -24,7 +25,7 @@
*/
class CountryLocale extends Model
{
use SoftDeletes;
use SoftDeletes, Cachable;
protected $table = 'country_locales';

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Providers;
use App\View\Composers\CategoryComposer;
use App\View\Composers\CountryLocaleComposer;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class ViewServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// Using class based composers...
View::composer('layouts.front.navigation', CategoryComposer::class);
View::composer('layouts.front.navigation', CountryLocaleComposer::class);
View::composer('layouts.front.footer', CategoryComposer::class);
View::composer('layouts.front.footer', CountryLocaleComposer::class);
if (auth()->check())
{
}
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\View\Composers;
use App\Models\Category;
use Illuminate\View\View;
class CategoryComposer
{
public function compose(View $view)
{
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\View\Composers;
use App\Models\CountryLocale;
use Illuminate\View\View;
class CountryLocaleComposer
{
public function compose(View $view)
{
$country_locales = CountryLocale::all();
$current_country_locale = null;
if (!is_null(request()->session()->get('view_country_locale')))
{
$current_country_locale = request()->session()->get('view_country_locale');
}
else
{
$current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'));
}
$view->with('country_locales', $country_locales)
->with('current_country_locale', $current_country_locale);
}
}

View File

@@ -10,6 +10,8 @@
"require": {
"php": "^8.1",
"artesaos/seotools": "^1.2",
"genealabs/laravel-model-caching": "^0.13.4",
"glhd/laravel-timezone-mapper": "^1.4",
"guzzlehttp/guzzle": "^7.2",
"kalnoy/nestedset": "^6.0",
"laravel/framework": "^10.10",
@@ -19,6 +21,7 @@
"stevebauman/location": "^7.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.8",
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.10",
"laravel/sail": "^1.18",

337
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d4622e7e11ee1dc87e72a4ec06a255f9",
"content-hash": "7e7ca4b12aa8cb62c957ab3f8746ab67",
"packages": [
{
"name": "artesaos/seotools",
@@ -651,6 +651,130 @@
],
"time": "2022-02-20T15:07:15+00:00"
},
{
"name": "genealabs/laravel-model-caching",
"version": "0.13.4",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-model-caching.git",
"reference": "631bb7f1d84c5863d82cff90e48152f65616597e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-model-caching/zipball/631bb7f1d84c5863d82cff90e48152f65616597e",
"reference": "631bb7f1d84c5863d82cff90e48152f65616597e",
"shasum": ""
},
"require": {
"genealabs/laravel-pivot-events": "^10.0",
"illuminate/cache": "^10.0",
"illuminate/config": "^10.0",
"illuminate/console": "^10.0",
"illuminate/container": "^10.0",
"illuminate/database": "^10.0",
"illuminate/http": "^10.0",
"illuminate/support": "^10.0",
"php": "^8.1"
},
"require-dev": {
"doctrine/dbal": "^3.3",
"fakerphp/faker": "^1.11",
"laravel/legacy-factories": "^1.3",
"laravel/nova": "^3.9",
"orchestra/testbench": "^8.0",
"orchestra/testbench-browser-kit": "^8.0",
"php-coveralls/php-coveralls": "^2.2",
"phpmd/phpmd": "^2.11",
"phpunit/phpunit": "^9.5",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.6",
"symfony/thanks": "^1.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"GeneaLabs\\LaravelModelCaching\\Providers\\Service"
]
}
},
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelModelCaching\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike Bronner",
"email": "hello@genealabs.com"
}
],
"description": "Automatic caching for Eloquent models.",
"support": {
"issues": "https://github.com/GeneaLabs/laravel-model-caching/issues",
"source": "https://github.com/GeneaLabs/laravel-model-caching/tree/0.13.4"
},
"time": "2023-03-27T13:53:10+00:00"
},
{
"name": "genealabs/laravel-pivot-events",
"version": "10.0.1",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-pivot-events.git",
"reference": "862371f6f89be296cc026c9cf5b372dca4d7958b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-pivot-events/zipball/862371f6f89be296cc026c9cf5b372dca4d7958b",
"reference": "862371f6f89be296cc026c9cf5b372dca4d7958b",
"shasum": ""
},
"require": {
"illuminate/database": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0"
},
"require-dev": {
"orchestra/testbench": "^7.0|^8.0",
"symfony/thanks": "^1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelPivotEvents\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike Bronner",
"email": "hello@genealabs.com",
"homepage": "https://genealabs.com",
"role": "Developer"
}
],
"description": "This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.",
"homepage": "https://github.com/GeneaLabs/laravel-pivot",
"keywords": [
"eloquent events",
"eloquent extra events",
"laravel BelongsToMany events",
"laravel pivot events",
"laravel sync events"
],
"support": {
"issues": "https://github.com/GeneaLabs/laravel-pivot/issues",
"source": "https://github.com/GeneaLabs/laravel-pivot"
},
"time": "2023-03-22T14:46:23+00:00"
},
{
"name": "geoip2/geoip2",
"version": "v2.13.0",
@@ -705,6 +829,67 @@
],
"time": "2022-08-05T20:32:58+00:00"
},
{
"name": "glhd/laravel-timezone-mapper",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/glhd/laravel-timezone-mapper.git",
"reference": "34f36a89b9f4464d295f05352f1b6fdd2bd93e19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/glhd/laravel-timezone-mapper/zipball/34f36a89b9f4464d295f05352f1b6fdd2bd93e19",
"reference": "34f36a89b9f4464d295f05352f1b6fdd2bd93e19",
"shasum": ""
},
"require": {
"illuminate/support": "*",
"php": ">=7.1.3"
},
"require-dev": {
"mockery/mockery": "^1.1",
"orchestra/testbench": "~3.0",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^7.3"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Galahad\\TimezoneMapper\\TimezoneMapperProvider"
],
"aliases": {
"TimezoneMapper": "Galahad\\TimezoneMapper\\Facades\\TimezoneMapper"
}
}
},
"autoload": {
"psr-4": {
"Galahad\\TimezoneMapper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Morrell",
"homepage": "http://www.cmorrell.com"
}
],
"description": "Timezone mapper for Laravel",
"keywords": [
"laravel",
"timezone"
],
"support": {
"issues": "https://github.com/glhd/laravel-timezone-mapper/issues",
"source": "https://github.com/glhd/laravel-timezone-mapper/tree/1.4.0"
},
"time": "2023-07-03T14:35:58+00:00"
},
{
"name": "graham-campbell/result-type",
"version": "v1.1.1",
@@ -6019,6 +6204,90 @@
}
],
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "aff3235fecb4104203b1e62c32239c56530eee32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/aff3235fecb4104203b1e62c32239c56530eee32",
"reference": "aff3235fecb4104203b1e62c32239c56530eee32",
"shasum": ""
},
"require": {
"illuminate/routing": "^9|^10",
"illuminate/session": "^9|^10",
"illuminate/support": "^9|^10",
"maximebf/debugbar": "^1.18.2",
"php": "^8.0",
"symfony/finder": "^6"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
"orchestra/testbench-dusk": "^5|^6|^7|^8",
"phpunit/phpunit": "^8.5.30|^9.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.8-dev"
},
"laravel": {
"providers": [
"Barryvdh\\Debugbar\\ServiceProvider"
],
"aliases": {
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
}
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Barryvdh\\Debugbar\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "PHP Debugbar integration for Laravel",
"keywords": [
"debug",
"debugbar",
"laravel",
"profiler",
"webprofiler"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.8.1"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2023-02-21T14:21:02+00:00"
},
{
"name": "doctrine/cache",
"version": "2.2.0",
@@ -6727,6 +6996,72 @@
},
"time": "2023-03-17T06:22:06+00:00"
},
{
"name": "maximebf/debugbar",
"version": "v1.18.2",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "17dcf3f6ed112bb85a37cf13538fd8de49f5c274"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/17dcf3f6ed112bb85a37cf13538fd8de49f5c274",
"reference": "17dcf3f6ed112bb85a37cf13538fd8de49f5c274",
"shasum": ""
},
"require": {
"php": "^7.1|^8",
"psr/log": "^1|^2|^3",
"symfony/var-dumper": "^4|^5|^6"
},
"require-dev": {
"phpunit/phpunit": ">=7.5.20 <10.0",
"twig/twig": "^1.38|^2.7|^3.0"
},
"suggest": {
"kriswallsmith/assetic": "The best way to manage assets",
"monolog/monolog": "Log using Monolog",
"predis/predis": "Redis storage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
}
},
"autoload": {
"psr-4": {
"DebugBar\\": "src/DebugBar/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/maximebf/php-debugbar",
"keywords": [
"debug",
"debugbar"
],
"support": {
"issues": "https://github.com/maximebf/php-debugbar/issues",
"source": "https://github.com/maximebf/php-debugbar/tree/v1.18.2"
},
"time": "2023-02-04T15:27:00+00:00"
},
{
"name": "mockery/mockery",
"version": "1.6.4",

View File

@@ -159,6 +159,8 @@
/*
* Package Service Providers...
*/
Barryvdh\Debugbar\ServiceProvider::class,
/*
* Application Service Providers...
@@ -168,6 +170,7 @@
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\ViewServiceProvider::class,
])->toArray(),
/*
@@ -183,6 +186,8 @@
'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class,
])->toArray(),
];

View File

@@ -26,7 +26,7 @@
*/
'fallbacks' => [
Stevebauman\Location\Drivers\MaxMind::class,
Stevebauman\Location\Drivers\Maxmind::class,
],
/*
@@ -55,7 +55,7 @@
*/
'testing' => [
'ip' => env('DEV_DEFAULT_IP', '202.188.193.93'),
'ip' => env('DEV_DEFAULT_IP'),
'enabled' => env('LOCATION_TESTING', true),
],

File diff suppressed because it is too large Load Diff

View File

@@ -4,4 +4,6 @@
'app_version' => '1.0.0',
'dev_default_ip' => env('DEV_DEFAULT_IP', '127.0.0.1'),
'fallback_country_slug' => 'my',
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 MiB

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->string('country_locale_slug')->after('country_locale_id')->default('my');
$table->foreign('country_locale_slug')->references('slug')->on('country_locales');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->dropColumn('country_locale_slug');
});
}
};

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('country_locales', function (Blueprint $table) {
$table->string('country_iso')->after('i18n');
$table->string('lang')->after('i18n');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('country_locales', function (Blueprint $table) {
$table->dropColumn('country_iso');
$table->dropColumn('lang');
});
}
};

View File

@@ -5,7 +5,7 @@
<div class="row justify-content-center text-center">
<div class="col-12 col-lg-8 py-5">
<h2 class="h3 fw-bold">ProductAlert is the place to be for top rated product reviews with recommendation such
as the right price, latest trend, from the best brands.</h2>
as the right price, latest trend, from the best brands in {{ get_country_name_by_iso($country_locale->country_iso) }}.</h2>
</div>
</div>
</div>
@@ -15,7 +15,7 @@
<div class="row g-3 justify-content-center">
@for ($i = 1; $i <= 3; $i++)
<div class="col-12 col-xl-3">
<a href="#" class="text-decoration-none">
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}" class="text-decoration-none">
<div class="card shadow-sm">
<img src="https://placekitten.com/400/300" alt="" class="card-img-top">
<div class="card-body">
@@ -38,11 +38,11 @@
<div class="container">
<div class="row justify-content-center">
<div class="col col-lg-9">
<h3 class="h4 fw-bold text-center mb-3">What's New</h3>
<h3 class="h4 fw-bold text-center mb-3">What's New in {{ get_country_name_by_iso($country_locale->country_iso) }}</h3>
<div class="row g-3">
@for ($i = 1; $i <= 12; $i++)
<div class="col-6">
<a href="#" class="text-decoration-none">
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}" class="text-decoration-none">
<div class="card">
<div class="row g-0">
<div class="col-md-4">
@@ -67,7 +67,7 @@
</div>
<div class="text-center py-3">
<a href="#" class="btn btn-primary">All News & Updates</a>
<a href="{{ route('home.country.posts', ['country' => $country_locale->country_iso ]) }}" class="btn btn-primary">All News & Updates</a>
</div>
</div>
</div>

View File

@@ -2,44 +2,50 @@
<footer class="py-5 container">
<div class="row">
<div class="col-6 col-md-2 mb-3">
<h5>Section</h5>
<ul class="nav flex-column">
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Home</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Features</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Pricing</a>
</li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">FAQs</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">About</a></li>
@foreach ($categories as $category)
<li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary" href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug ]) }}">{{ $category->name }}</a>
</li>
@endforeach
</ul>
</div>
<div class="col-6 col-md-2 mb-3">
<h5>Section</h5>
<ul class="nav flex-column">
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Home</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Features</a>
<li class="nav-item mb-2">
<a href="#" class="nav-link p-0 text-body-secondary">About Us</a>
</li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Pricing</a>
<li class="nav-item mb-2">
<a href="#" class="nav-link p-0 text-body-secondary">Contact Us</a>
</li>
<li class="nav-item mb-2">
<a href="#" class="nav-link p-0 text-body-secondary">Advertise with us</a>
</li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">FAQs</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">About</a></li>
</ul>
</div>
<div class="col-6 col-md-2 mb-3">
<h5>Section</h5>
<ul class="nav flex-column">
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Home</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Features</a>
</li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">Pricing</a>
</li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">FAQs</a></li>
<li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-body-secondary">About</a></li>
</ul>
</div>
<div class="col-md-5 offset-md-1 mb-3">
<div class="dropdown mb-4">
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="dropdownMenuSwitch"
data-bs-toggle="dropdown" aria-expanded="false">
{{ $current_country_locale->name }}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuSwitch">
@foreach ($country_locales as $country_locale)
@if ($country_locale->id != $current_country_locale->id)
<li><a class="dropdown-item" href="{{ route('home.country', [
'country' => $country_locale->slug
]) }}">{{ $country_locale->name }}</a></li>
@endif
@endforeach
</ul>
</div>
<form>
<h5>Subscribe to our newsletter</h5>
<p>Monthly digest of what's new and exciting from us.</p>
@@ -52,9 +58,9 @@
</div>
</div>
<div class="d-flex flex-column flex-sm-row justify-content-between py-4 my-4">
<div class="d-flex flex-column flex-sm-row justify-content-center py-4 my-4">
<p>© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.</p>
<ul class="list-unstyled d-flex">
{{-- <ul class="list-unstyled d-flex">
<li class="ms-3"><a class="link-body-emphasis" href="#"><svg class="bi" width="24"
height="24">
<use xlink:href="#twitter"></use>
@@ -67,7 +73,7 @@
height="24">
<use xlink:href="#facebook"></use>
</svg></a></li>
</ul>
</ul> --}}
</div>
</footer>
</div>

View File

@@ -8,7 +8,9 @@
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasNavbar"
aria-labelledby="offcanvasNavbarLabel">
<div class="offcanvas-header">
<h4 class="offcanvas-title fw-bold mb-0" id="offcanvasNavbarLabel">{{ config('app.name') }}</h4>
<h4 class="offcanvas-title fw-bold mb-0" id="offcanvasNavbarLabel">
{{ config('app.name') }} {{ str_contains(request()->route()->getName(), 'home.country') ? get_country_emoji_by_iso($current_country_locale->country_iso) : '' }}
</h4>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body p-0">
@@ -17,12 +19,16 @@
<div class="dropdown d-grid">
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="dropdownMenuSwitch"
data-bs-toggle="dropdown" aria-expanded="false">
{{ $country->name }}
{{ $current_country_locale->name }}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuSwitch">
<li><a class="dropdown-item" href="#">Country 1</a></li>
<li><a class="dropdown-item" href="#">Country 2</a></li>
<li><a class="dropdown-item" href="#">Country 3</a></li>
@foreach ($country_locales as $country_locale)
@if ($country_locale->id != $current_country_locale->id)
<li><a class="dropdown-item" href="{{ route('home.country', [
'country' => $country_locale->slug
]) }}">{{ $country_locale->name }}</a></li>
@endif
@endforeach
</ul>
</div>
</div>
@@ -36,7 +42,7 @@
</li>
@foreach ($categories as $category)
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">{{ $category->name }}</a>
<a class="nav-link active" aria-current="page" href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug ]) }}">{{ $category->name }}</a>
</li>
@endforeach
@@ -46,14 +52,16 @@
</div>
</div>
<a href="/" class="d-inline-flex link-body-emphasis text-decoration-none">
<h1 class="h4 mb-0 fw-bold">{{ config('app.name') }}</h1>
<h1 class="h4 mb-0 fw-bold">
{{ config('app.name') }} {{ str_contains(request()->route()->getName(), 'home.country') ? get_country_emoji_by_iso($current_country_locale->country_iso) : '' }}
</h1>
</a>
</div>
<ul class="nav col-12 col-md-auto mb-2 justify-content-center mb-md-0">
@foreach ($categories as $category)
@if ($category->is_top)
<li><a href="#" class="nav-link px-2 link-secondary">{{ $category->short_name }}</a></li>
<li><a href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug ]) }}" class="nav-link px-2 link-secondary">{{ $category->short_name }}</a></li>
@endif
@endforeach
</ul>

View File

@@ -17,6 +17,13 @@
Route::get('/{country}', [App\Http\Controllers\Front\HomeController::class, 'country'])->name('home.country');
Route::get('/{country}/posts', [App\Http\Controllers\Front\HomeController::class, 'posts'])->name('home.country.posts');
Route::get('/{country}/posts/{post}', [App\Http\Controllers\Front\HomeController::class, 'post'])->name('home.country.post');
Route::get('/{country}/{category}', [App\Http\Controllers\Front\HomeController::class, 'countryCategory'])->name('home.country.category');
Auth::routes();
Route::prefix('admin')->middleware('auth')->group(function () {

2
storage/debugbar/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore