I want to save more than one university under one student. For html select I used
<select class="selectpicker" multiple data-live-search="true" name="university">
@foreach($districts as $row)
<option value= {{$row->name}} > {{$row->name}} </option>
@endforeach
</select>
This taking previously saved university. I am using district as university.
Controller->
public function store(Request $request)
{
Seller_info::create([
'name' => $request['name'],
'email' => $request['email'],
'passport' => $request['passport'],
'phone_number' => $request['phone_number'],
'address' => $request['address'],
'dateofbirth' => $request['dateofbirth'],
'ielts' => $request['ielts'],
'openingcharge' => $request['openingcharge'],
'serviceCharge' => $request['serviceCharge'],
'applydate' => $request['applydate'],
'visaStatus'=> $request['visaStatus'],
'country' => $request['country'],
'university'=> $request['university'],
]);
return back();
}
This is saving the students. This is a mishmash code I am sorry about that. I am working on a different for fast learning. Here I am using seller_info as student.
The data is is saving university but only one university in the database. I tried to use for loop in case of storing. But could not able to implement it properly.
My table file->
Schema::create('seller_infos', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('email')->unique();
$table->string('passport')->nullable();
$table->string('phone_number')->unique();
$table->string('address')->nullable();
$table->string('dateofbirth')->nullable();
$table->string('ielts')->nullable();
$table->string('openingcharge')->nullable();
$table->string('serviceCharge')->nullable();
$table->string('applydate')->nullable();
$table->string('visaStatus')->nullable();
$table->string('country')->nullable();
$table->string('university')->nullable();
$table->timestamps();
});
And model
protected $fillable = [
'name', 'email', 'passport', 'phone_number','address','dateofbirth','ielts', 'openingcharge','serviceCharge','applydate',
'visaStatus','country','university'
];