I wonder how to apply one data and the other data is automatically completed to the code.
I've tried pluck() method and I just get value like the code bellow :
this is the controller
public function __construct(PKLRepository $pKLRepo)
{
$this->pKLRepository = $pKLRepo;
$this->data = Siswa::pluck('nis','id');
}
public function create()
{
return view('p_k_l_s.create')
->with('data', $this->data);
}
create.blade.php
<div class="form-group col-sm-6">
{!! Form::label('nis', 'NIS:') !!}
{!! Form::select('nis', $data, null, ['class' => 'form-control']) !!}
</div>
<!-- Name Field -->
<div class="form-group col-sm-6">
{!! Form::label('name', 'Nama:') !!}
{!! Form::text('name', null,['class' => 'form-control']) !!}
</div>
<!-- Academic Year Field -->
<div class="form-group col-sm-12 col-lg-12">
{!! Form::label('academic_year', 'Tahun Akademik:') !!}
{!! Form::text('academic_year', null, ['class' => 'form-control'])
!!}
</div>
the code above just return nis value, but I want to autocompleted the form if I select one of the values from nis. Any suggest?