Skip to content

Commit

Permalink
Fix the order of speakers on the line up page based on the sponsor ti…
Browse files Browse the repository at this point in the history
…er level
  • Loading branch information
v-stamenova committed Oct 14, 2023
1 parent 62b6bc9 commit e48e06a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/Http/Controllers/SpeakerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\Speaker;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;

class SpeakerController extends Controller
Expand All @@ -15,15 +16,18 @@ class SpeakerController extends Controller
*/
public function index()
{
$speakers = Speaker::where('is_approved', 1)
->where('is_main_speaker', 1)
->get();
$speakers = Speaker::join('users', 'speakers.user_id', '=', 'users.id')
->leftJoin('teams', 'users.current_team_id', '=', 'teams.id')
->where('speakers.is_approved', '=', 1)
->orderByRaw('ISNULL(teams.sponsor_tier_id), teams.sponsor_tier_id ASC, users.name ASC')
->get('speakers.*');

return view('speakers.index', compact('speakers'));
}


// TODO: Refactor with gate

/**
* Allows the auth user to cohost a presentation if they are not already
* hosting/cohosting a presentation; accessible only to the gold sponsor
Expand Down

0 comments on commit e48e06a

Please sign in to comment.