when i click on the dropdwon menu of fixtures i get list of fixtures then i choose a fixture then on the next field after I select that there is a team id field in that field i want to choose between the teams i chose in the fixtures field then there is a players id field and in this field i want players to be listed in a dropdown with the specific team id i chose before on the team id here is my controller:-
`class LineupController extends AppBaseController {
public function index(LineupDataTable $lineupDataTable)
{
return $lineupDataTable->render('lineups.index');
}
public function create()
{
$fixtures = $this->getFormattedFixtures();
$teams = Team::pluck('team_name', 'id')->map(function ($item) {
return $item['english'].'('.$item['amharic'].')';
});
$players = Player::pluck('display_name', 'id')->map(function( $item) {
return $item['english'].'('.$item['amharic'].')';
});
return view('lineups.create', compact('fixtures', 'teams','players'));
}
public function getFormattedFixtures()
{
return Fixture::with('localTeam', 'visitorTeam')->get()->map(function ($fixture) {
$fixture->fixture_name = $fixture->localTeam->team_name['english'].' Vs '.$fixture->visitorTeam->team_name['english'].' ('.$fixture->starting_at->toFormattedDateString().')';
return $fixture;
})->pluck('fixture_name', 'id');
}
}` and here is my blade fields:-
<!-- Fixture Id Field -->
`<div class="form-group">
<div class="row">
{!! Form::label('fixture_id', 'Fixture:', ['class' => 'col-md-3 col-lg-3 col-12 control-label']) !!}
<div class="col-md-9 col-lg-9 col-12">
{!! Form::select('fixture_id', $fixtures, null, ['class' => 'form-control', 'placeholder' => 'Select Fixture']) !!}
</div>
</div>
</div>`
<!-- Team Id Field -->
`<div class="form-group">
<div class="row">
{!! Form::label('team_id', 'Team:', ['class' => 'col-md-3 col-lg-3 col-12 control-label']) !!}
<div class="col-md-9 col-lg-9 col-12">
{!! Form::select('team_id', [], null, ['class' => 'form-control', 'placeholder' => 'Select Team']) !!}
</div>
</div>
</div>`
<!-- Player Id Field -->
`<div class="form-group">
<div class="row">
{!! Form::label('player_id', 'Player:', ['class' => 'col-md-3 col-lg-3 col-12 control-label']) !!}
<div class="col-md-9 col-lg-9 col-12">
{!! Form::select('player_id', [], null, ['class' => 'form-control', 'placeholder' => 'Select Player']) !!}
</div>
</div>
</div>`
it only fetches the fixtures then when i click on the team id there is no data