Add (post manage)

Add (post country viewing)
This commit is contained in:
2023-07-28 02:29:11 +08:00
parent e70195f4f7
commit ded1643e5f
49 changed files with 4484 additions and 3844 deletions

View File

@@ -2,25 +2,23 @@
namespace App\View\Composers;
use App\Models\CountryLocale;
use App\Models\Category;
use App\Models\CountryLocale;
use Illuminate\View\View;
class CategoryComposer
{
public function compose(View $view)
{
$current_country_locale = request()->session()->get('view_country_locale');
$current_country_locale = request()->session()->get('view_country_locale');
if (is_null($current_country_locale))
{
$current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'))->first();
}
if (is_null($current_country_locale)) {
$current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'))->first();
}
$categories = Category::where('country_locale_id', $current_country_locale->id)->get();
$categories = Category::where('country_locale_id', $current_country_locale->id)->get();
$view->with('categories', $categories);
$view->with('categories', $categories);
}
}

View File

@@ -3,27 +3,23 @@
namespace App\View\Composers;
use App\Models\CountryLocale;
use Illuminate\View\View;
class CountryLocaleComposer
{
public function compose(View $view)
{
$country_locales = CountryLocale::all();
$country_locales = CountryLocale::all();
$current_country_locale = null;
$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'))->first();
}
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'))->first();
}
$view->with('country_locales', $country_locales)
$view->with('country_locales', $country_locales)
->with('current_country_locale', $current_country_locale);
}