Initial Commit

This commit is contained in:
Mark Gregory
2026-09-12 20:21:11 +01:00
commit 35d3f344c8
62 changed files with 3215 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers;
use App\Models\DjProfile;
use Illuminate\Http\Request;
class DjController extends Controller
{
public function index(Request $r)
{
$q = DjProfile::query()->where('is_published', true)->with('genres');
if ($r->filled('location')) {
$q->where('city', 'like', '%'.$r->string('location').'%');
} if ($r->filled('max_price')) {
$q->where('price_from', '<=', $r->integer('max_price'));
}
return view('djs.index', ['djs' => $q->orderByDesc('is_featured')->orderByDesc('average_rating')->paginate(12)->withQueryString()]);
}
public function show(DjProfile $djProfile)
{
abort_unless($djProfile->is_published, 404);
return view('djs.show', ['dj' => $djProfile->load(['genres', 'reviews' => fn ($q) => $q->where('status', 'published')->latest()])]);
}
public function apiIndex()
{
return DjProfile::where('is_published', true)->with('genres')->paginate(20);
}
}