Answer the question
In order to leave comments, you need to log in
How to display information from 2 unrelated tables on a page in Laravel?
I need to display 2 unrelated tables on one page. I wrote this code:
web.php
code Controller code
Route::get('/events', '[email protected]');
public function index()
{
return view('events', [
'events' => DB::table('events')->paginate(7),
'info' => DB::table('info')
]);
}
<select>
@foreach($events as $event)
<option value="{{ $event->id }}">{{ $event->$name}}</option>
@endforeach
</select>
<select>
@foreach($info as $inf)
<option value="{{ $inf->id }}">{{ $inf->$infname}}</option>
@endforeach
</select>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question