-
app/Models/Job.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; class Job extends Model { // ... public function scopeNotExpired($query) { return $query->where(function ($query) { $query->where("expires_at", ">", now())->orWhereNull("expires_at"); }); } // ... }
-
app/Http/Controllers/Front/HomepageController.php
Open in GitHubuse App\Http\Controllers\Controller; use App\Models\Job; use Illuminate\Http\Request; use Inertia\Inertia; class HomepageController extends Controller { public function __invoke(Request $request) { $jobs = Job::notExpired() ->with('user', 'department', 'location', 'contractType') ->orderByDesc('id') ->applyFilters($request) ->simplePaginate(10) ->withQueryString(); // ... } }