To access variables inside a blade when you're returning the view you need to pass an additional associative array argument. For example:
return view('master', ['article' => $article]);
This will allow you to access whatever information you're retrieving from the database or what have you. This can be done in your routes although I don't recommend it. Using a controller is your best bet.
I know that, but this is a master.blade.php, so I am not returning any view on a route. It's just used for templating purposes.
You can call variable directly from your view file .. example:
@foreach(\App\Product::get() as $product)
<li><a href="{{ url('product/')}}{{$product->id}}">{{ $product->title }}</a></li>
@endforeach
This mean you'll call the variable directly from your Model ( Product ).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community