I'm trying to create a gallery page in laravel 4, where the gallery page displays the categories and if you click on a category then a list of all the items that belong to that category is displayed. I'm having an issue with mine. When I click on my category I get a blank page. So I was wondering if anyone here knows of a laravel 4 tutorial to do what I need. But just in case you want to see my code here it is.
routes.php
Route::get('/', 'HomeController@index');
Route::get('/{id}', 'HomeController@content');
Route::get('/{title}', array('as' => 'test', 'uses' => 'HomeController@test'));
my pcategory.blade.php
<div class="row">
<div class="col-lg-12 gallery">
<ul class="pics">
@foreach($pages->pcategory as $port)
<?php
$portImage = getImagesArray($port->image)
?>
<li>
@if(!empty($portImage))
@foreach($portImage as $portImg)
{{ HTML::linkRoute('test', $port->title, $port->id)}}
@endforeach
@endif
</li>
@endforeach
</ul>
</div>
</div>
my HomeController.php
public function test($title){
echo "public function test";
}
The third paramater of linkRoute function should be array. Try:
{{ HTML::linkRoute('test', $port->title, ['title' => $port->id] )}}
Maybe another error - controller function test expects a title, but View sends a id.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.