I have duplicate databases and I want to fetch data from the secondary database, inside my Register form which has POST
method.
I tried what I can do still stuck on it few days.
This is my register.blade
where I want to fetch data :
{{ csrf_field() }}
@if($getTypes->count())
@foreach($getTypes as $getType)
<option value="{{$getType->nameMn}}">
{{$getType->nameMn}}
</option>
@endforeach
@endif
Here is the controller :
public function getTypes(){
$db = DB::connection('mysql2');
$getTypes = $db->table('merchant_types')->get();
return view('auth/register', ['getTypes'=>$getTypes]);
}
Route::post('register', 'MerchantController@getTypes');
And here goes the Route, I've tried post & get everything.
On my view blade this error is showing :
Undefined variable: getTypes"