Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have route defined in the Route.php file like below

Route::get('/SubCategories-List/{categoryID}', 'SkillsCategory_Controller@SubCategories');

Below is the code done in Blade for showing list of records.

@foreach($Categories as $Category)
    <tr class="odd pointer">
        <td class=" last">
            <a href="{{Route('SubCategories-List', [$Category->CategoryID])}}">
                 Sub Categories
            </a>
        </td>
    </tr>
@endforeach

I am getting the following error when action method calls the blade

Route [SubCategories-List] not defined.

Am I missing something ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
164 views
Welcome To Ask or Share your Answers For Others

1 Answer

I tried below and worked.

Reference

Route in Route.php

Route::get('/SubCategories-List/{categoryID}', 
           array(
                   'uses' => 'SkillsCategory_Controller@SubCategories', 
                   'as'   => 'SubCategories-List'
                )
          );

Anchor link in Blade

{{
    Html::linkRoute('SubCategories-List', 
                  'Sub Categories', 
                  array($Category->CategoryID), 
                  array('style' => 'text-decoration: underline;'))
}}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...