mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
orderByDesc orderBy
This commit is contained in:
@@ -30,6 +30,9 @@ class Meetups extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->meetups = Meetup::query()
|
$this->meetups = Meetup::query()
|
||||||
|
->with([
|
||||||
|
'city',
|
||||||
|
])
|
||||||
->where('name', 'ilike', '%'.$this->search.'%')
|
->where('name', 'ilike', '%'.$this->search.'%')
|
||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class BookCaseTable extends DataTableComponent
|
|||||||
{
|
{
|
||||||
$this->setPrimaryKey('id')
|
$this->setPrimaryKey('id')
|
||||||
->setAdditionalSelects(['id', 'homepage'])
|
->setAdditionalSelects(['id', 'homepage'])
|
||||||
->setDefaultSort('orange_pills_count', 'desc')
|
|
||||||
->setThAttributes(function (Column $column) {
|
->setThAttributes(function (Column $column) {
|
||||||
return [
|
return [
|
||||||
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
||||||
@@ -125,7 +124,9 @@ class BookCaseTable extends DataTableComponent
|
|||||||
])
|
])
|
||||||
->withCount([
|
->withCount([
|
||||||
'orangePills',
|
'orangePills',
|
||||||
]);
|
])
|
||||||
|
->orderByDesc('orange_pills_count')
|
||||||
|
->orderBy('book_cases.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewHistoryModal($modelId): void
|
public function viewHistoryModal($modelId): void
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class CityTable extends DataTableComponent
|
|||||||
public function configure(): void
|
public function configure(): void
|
||||||
{
|
{
|
||||||
$this->setPrimaryKey('id')
|
$this->setPrimaryKey('id')
|
||||||
->setDefaultSort('course_events_count', 'desc')
|
|
||||||
->setAdditionalSelects(['id'])
|
->setAdditionalSelects(['id'])
|
||||||
->setThAttributes(function (Column $column) {
|
->setThAttributes(function (Column $column) {
|
||||||
return [
|
return [
|
||||||
@@ -79,7 +78,9 @@ class CityTable extends DataTableComponent
|
|||||||
'venues',
|
'venues',
|
||||||
'courseEvents',
|
'courseEvents',
|
||||||
])
|
])
|
||||||
->whereHas('country', fn($query) => $query->where('code', $this->country));
|
->whereHas('country', fn($query) => $query->where('code', $this->country))
|
||||||
|
->orderByDesc('course_events_count')
|
||||||
|
->orderBy('cities.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function proximitySearch($id)
|
public function proximitySearch($id)
|
||||||
@@ -116,7 +117,7 @@ class CityTable extends DataTableComponent
|
|||||||
return to_route('bookCases.table.bookcases', [
|
return to_route('bookCases.table.bookcases', [
|
||||||
'#table',
|
'#table',
|
||||||
'country' => $this->country,
|
'country' => $this->country,
|
||||||
'table' => [
|
'table' => [
|
||||||
'filters' => [
|
'filters' => [
|
||||||
'byids' => $ids->implode(',')
|
'byids' => $ids->implode(',')
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -95,7 +95,9 @@ class CourseTable extends DataTableComponent
|
|||||||
'courseEvents',
|
'courseEvents',
|
||||||
])
|
])
|
||||||
->whereHas('courseEvents.venue.city.country',
|
->whereHas('courseEvents.venue.city.country',
|
||||||
fn($query) => $query->where('countries.code', $this->country));
|
fn($query) => $query->where('countries.code', $this->country))
|
||||||
|
->orderByDesc('course_events_count')
|
||||||
|
->orderBy('courses.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function courseSearch($id)
|
public function courseSearch($id)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class LecturerTable extends DataTableComponent
|
|||||||
{
|
{
|
||||||
$this->setPrimaryKey('id')
|
$this->setPrimaryKey('id')
|
||||||
->setAdditionalSelects(['id'])
|
->setAdditionalSelects(['id'])
|
||||||
->setDefaultSort('courses_events_count', 'desc')
|
|
||||||
->setThAttributes(function (Column $column) {
|
->setThAttributes(function (Column $column) {
|
||||||
return [
|
return [
|
||||||
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
||||||
@@ -77,7 +76,6 @@ class LecturerTable extends DataTableComponent
|
|||||||
return Lecturer::query()
|
return Lecturer::query()
|
||||||
->withCount([
|
->withCount([
|
||||||
'courses',
|
'courses',
|
||||||
'coursesEvents',
|
|
||||||
'libraryItems',
|
'libraryItems',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
namespace App\Http\Livewire\Tables;
|
namespace App\Http\Livewire\Tables;
|
||||||
|
|
||||||
use App\Models\Meetup;
|
use App\Models\Meetup;
|
||||||
use App\Models\MeetupEvent;
|
|
||||||
use App\Models\MeetupUser;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||||
@@ -18,7 +16,7 @@ class MeetupTable extends DataTableComponent
|
|||||||
public function configure(): void
|
public function configure(): void
|
||||||
{
|
{
|
||||||
$this->setPrimaryKey('id')
|
$this->setPrimaryKey('id')
|
||||||
//->setDebugEnabled()
|
->setDebugEnabled()
|
||||||
->setAdditionalSelects(['id', 'slug'])
|
->setAdditionalSelects(['id', 'slug'])
|
||||||
->setThAttributes(function (Column $column) {
|
->setThAttributes(function (Column $column) {
|
||||||
return [
|
return [
|
||||||
@@ -82,17 +80,11 @@ class MeetupTable extends DataTableComponent
|
|||||||
'users',
|
'users',
|
||||||
'meetupEvents' => fn($query) => $query->where('start', '>=',
|
'meetupEvents' => fn($query) => $query->where('start', '>=',
|
||||||
now()),
|
now()),
|
||||||
]);
|
])
|
||||||
// ->when(!$this->country, fn($query) => $query->orderBy(
|
->when(!$this->country, fn($query) => $query->orderByDesc('users_count')
|
||||||
// MeetupUser::select('meetup_id')
|
->orderBy('meetups.id'))
|
||||||
// ->whereColumn('meetup_id', 'meetups.id')
|
->when($this->country, fn($query) => $query->orderByDesc('meetup_events_count')
|
||||||
// ))
|
->orderBy('meetups.id'));
|
||||||
// ->when($this->country, fn($query) => $query->orderBy(
|
|
||||||
// MeetupEvent::select('start')
|
|
||||||
// ->whereColumn('meetup_id', 'meetups.id')
|
|
||||||
// ->where('start', '>=', now())
|
|
||||||
// ->orderBy('start')
|
|
||||||
// ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function meetupEventSearch($id)
|
public function meetupEventSearch($id)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class VenueTable extends DataTableComponent
|
|||||||
{
|
{
|
||||||
$this->setPrimaryKey('id')
|
$this->setPrimaryKey('id')
|
||||||
->setAdditionalSelects(['id'])
|
->setAdditionalSelects(['id'])
|
||||||
->setDefaultSort('course_events_count', 'desc')
|
|
||||||
->setThAttributes(function (Column $column) {
|
->setThAttributes(function (Column $column) {
|
||||||
return [
|
return [
|
||||||
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
||||||
@@ -70,7 +69,9 @@ class VenueTable extends DataTableComponent
|
|||||||
->withCount([
|
->withCount([
|
||||||
'courseEvents',
|
'courseEvents',
|
||||||
])
|
])
|
||||||
->whereHas('city.country', fn($query) => $query->where('code', $this->country));
|
->whereHas('city.country', fn($query) => $query->where('code', $this->country))
|
||||||
|
->orderByDesc('course_events_count')
|
||||||
|
->orderBy('venues.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function venueSearch($id)
|
public function venueSearch($id)
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ class Meetup extends Resource
|
|||||||
'city.name',
|
'city.name',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static $with = [
|
||||||
|
'city',
|
||||||
|
'createdBy',
|
||||||
|
];
|
||||||
|
|
||||||
public static function afterCreate(NovaRequest $request, Model $model)
|
public static function afterCreate(NovaRequest $request, Model $model)
|
||||||
{
|
{
|
||||||
auth()
|
auth()
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ class MeetupEvent extends Resource
|
|||||||
'meetup.name',
|
'meetup.name',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static $with = [
|
||||||
|
'meetup',
|
||||||
|
'createdBy',
|
||||||
|
];
|
||||||
|
|
||||||
public static function label()
|
public static function label()
|
||||||
{
|
{
|
||||||
return __('Meetup Event');
|
return __('Meetup Event');
|
||||||
|
|||||||
Reference in New Issue
Block a user