Answer the question
In order to leave comments, you need to log in
How to pass data to laravel view?
there is a link that, when clicked, redirects to the adminpanel/home
route for it:
Route::get('/adminpanel/home', '[email protected]');
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Request;
class lotscontroller extends Controller
{
public function index(Request $request){
if ($request->has('home')){
$lots = DB::table('lots')->get();
return view('admin.home', compact('lots'));
}
else{
return view('adminPanel');
}
}
}
@extends('adminPanel')
@section('content')
@foreach($lots as $lot)
{{$lot->id}}
@endforeach
@endsection
@if(isset($_GET['home']))
@yield('content')
@endif
Answer the question
In order to leave comments, you need to log in
$_GET was not passed to the template, $request->has('home') checks for more than just GET. but also POST
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question