mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
allow custom countries
This commit is contained in:
@@ -35,8 +35,8 @@ class Header extends Component
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'c' => 'required',
|
||||
'l' => 'required',
|
||||
'c' => 'required',
|
||||
'l' => 'required',
|
||||
'timezone' => 'required',
|
||||
];
|
||||
}
|
||||
@@ -48,8 +48,8 @@ class Header extends Component
|
||||
$this->c = Cookie::get('country') ?: config('app.country');
|
||||
if (!$this->country) {
|
||||
$this->country = Country::query()
|
||||
->where('code', $this->c)
|
||||
->first();
|
||||
->where('code', $this->c)
|
||||
->first();
|
||||
}
|
||||
$this->currentRouteName = Route::currentRouteName();
|
||||
}
|
||||
@@ -82,81 +82,80 @@ class Header extends Component
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.header', [
|
||||
'news' => LibraryItem::query()
|
||||
->with([
|
||||
'createdBy.roles',
|
||||
'lecturer',
|
||||
'tags',
|
||||
])
|
||||
->where('type', 'markdown_article')
|
||||
->where('approved', true)
|
||||
->where('news', true)
|
||||
->orderByDesc('created_at')
|
||||
->take(2)
|
||||
->get(),
|
||||
'meetups' => MeetupEvent::query()
|
||||
->with([
|
||||
'meetup.users',
|
||||
'meetup.city.country',
|
||||
])
|
||||
->where('start', '>', now())
|
||||
->orderBy('start')
|
||||
->take(2)
|
||||
->get(),
|
||||
'courseEvents' => CourseEvent::query()
|
||||
->with([
|
||||
'venue.city.country',
|
||||
'course.lecturer',
|
||||
])
|
||||
->where('from', '>', now())
|
||||
->orderBy('from')
|
||||
->take(2)
|
||||
->get(),
|
||||
'libraryItems' => LibraryItem::query()
|
||||
->with([
|
||||
'lecturer',
|
||||
])
|
||||
->where('type', '<>', 'markdown_article')
|
||||
->orderByDesc('created_at')
|
||||
->take(2)
|
||||
->get(),
|
||||
'bitcoinEvents' => BitcoinEvent::query()
|
||||
->with([
|
||||
'venue',
|
||||
])
|
||||
->where('from', '>', now())
|
||||
->orderBy('from')
|
||||
->take(2)
|
||||
->get(),
|
||||
'orangePills' => OrangePill::query()
|
||||
->with([
|
||||
'user',
|
||||
'bookCase',
|
||||
])
|
||||
->orderByDesc('date')
|
||||
->take(2)
|
||||
->get(),
|
||||
'news' => LibraryItem::query()
|
||||
->with([
|
||||
'createdBy.roles',
|
||||
'lecturer',
|
||||
'tags',
|
||||
])
|
||||
->where('type', 'markdown_article')
|
||||
->where('approved', true)
|
||||
->where('news', true)
|
||||
->orderByDesc('created_at')
|
||||
->take(2)
|
||||
->get(),
|
||||
'meetups' => MeetupEvent::query()
|
||||
->with([
|
||||
'meetup.users',
|
||||
'meetup.city.country',
|
||||
])
|
||||
->where('start', '>', now())
|
||||
->orderBy('start')
|
||||
->take(2)
|
||||
->get(),
|
||||
'courseEvents' => CourseEvent::query()
|
||||
->with([
|
||||
'venue.city.country',
|
||||
'course.lecturer',
|
||||
])
|
||||
->where('from', '>', now())
|
||||
->orderBy('from')
|
||||
->take(2)
|
||||
->get(),
|
||||
'libraryItems' => LibraryItem::query()
|
||||
->with([
|
||||
'lecturer',
|
||||
])
|
||||
->where('type', '<>', 'markdown_article')
|
||||
->orderByDesc('created_at')
|
||||
->take(2)
|
||||
->get(),
|
||||
'bitcoinEvents' => BitcoinEvent::query()
|
||||
->with([
|
||||
'venue',
|
||||
])
|
||||
->where('from', '>', now())
|
||||
->orderBy('from')
|
||||
->take(2)
|
||||
->get(),
|
||||
'orangePills' => OrangePill::query()
|
||||
->with([
|
||||
'user',
|
||||
'bookCase',
|
||||
])
|
||||
->orderByDesc('date')
|
||||
->take(2)
|
||||
->get(),
|
||||
'projectProposals' => ProjectProposal::query()
|
||||
->with([
|
||||
'votes',
|
||||
'user',
|
||||
])
|
||||
->take(2)
|
||||
->get(),
|
||||
'cities' => City::query()
|
||||
->select(['latitude', 'longitude'])
|
||||
->get(),
|
||||
'countries' => Country::query()
|
||||
->select('id', 'name', 'code')
|
||||
->orderBy('name')
|
||||
->get()
|
||||
->map(function (Country $country) {
|
||||
$country->name = config('countries.emoji_flags')[str($country->code)
|
||||
->upper()
|
||||
->toString()].' '.$country->name;
|
||||
->with([
|
||||
'votes',
|
||||
'user',
|
||||
])
|
||||
->take(2)
|
||||
->get(),
|
||||
'cities' => City::query()
|
||||
->select(['latitude', 'longitude'])
|
||||
->get(),
|
||||
'countries' => Country::query()
|
||||
->select('id', 'name', 'code')
|
||||
->orderBy('name')
|
||||
->get()
|
||||
->map(function (Country $country) {
|
||||
$flag = config('countries.emoji_flags')[str($country->code)->upper()->toString()] ?? '';
|
||||
$country->name = $flag . ' ' . $country->name;
|
||||
|
||||
return $country;
|
||||
}),
|
||||
return $country;
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,16 +55,15 @@ class Welcome extends Component
|
||||
{
|
||||
return view('livewire.frontend.welcome', [
|
||||
'countries' => Country::query()
|
||||
->select('id', 'name', 'code')
|
||||
->orderBy('name')
|
||||
->get()
|
||||
->map(function (Country $country) {
|
||||
$country->name = config('countries.emoji_flags')[str($country->code)
|
||||
->upper()
|
||||
->toString()].' '.$country->name;
|
||||
->select('id', 'name', 'code')
|
||||
->orderBy('name')
|
||||
->get()
|
||||
->map(function (Country $country) {
|
||||
$flag = config('countries.emoji_flags')[str($country->code)->upper()->toString()] ?? '';
|
||||
$country->name = $flag . ' ' . $country->name;
|
||||
|
||||
return $country;
|
||||
}),
|
||||
return $country;
|
||||
}),
|
||||
])->layout('layouts.guest', [
|
||||
'SEOData' => new SEOData(
|
||||
title: __('Welcome'),
|
||||
|
||||
@@ -37,6 +37,7 @@ class CountryPolicy extends BasePolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
dd($user);
|
||||
return $user->can((new \ReflectionClass($this))->getShortName().'.'.__FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
1557
composer.lock
generated
1557
composer.lock
generated
File diff suppressed because it is too large
Load Diff
2
public/vendor/horizon/app.js
vendored
2
public/vendor/horizon/app.js
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/horizon/mix-manifest.json
vendored
2
public/vendor/horizon/mix-manifest.json
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"/app.js": "/app.js?id=ff1533ec4a7afad65c5bd7bcc2cc7d7b",
|
||||
"/app.js": "/app.js?id=79bae40dcb18de9ca1b5d0008c577471",
|
||||
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
|
||||
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
|
||||
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
|
||||
|
||||
@@ -194,7 +194,7 @@ Route::get('/auth/login', \App\Http\Livewire\Auth\Login::class)
|
||||
->name('auth.login');
|
||||
|
||||
Route::get('/login-as-admin', function(){
|
||||
auth()->loginUsingId(2);
|
||||
auth()->loginUsingId(144);
|
||||
return redirect()->route('dashboard');
|
||||
})->name('loginAsAdmin');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user