路由没有为[module-name]定义提示路径

时间:2017-12-11 12:58:29

标签: laravel-5

我使用的是Laravel5.5和Module软件包。我有一个学生模块,并希望将其作为前端的默认值,因此laravel的默认路由/ web.php的已提交代码 这是我学生的路线:

<?php

    Route::group(['middleware' => 'web', 'namespace' => 'Modules\Student\Http\Controllers'], function() {

        /** Frontend routes which does not require authentication
         *
         */
        Route::get('/', 'FrontEndController@index')->name('frontend.home');
        Route::get('/program-search', 'FrontEndController@programs')->name('student.programs');
        Route::get('/univeristy-search', 'FrontEndController@univerities')->name('student.universities');
    });

这是我的控制器代码:

<?php
    namespace Modules\Student\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Controllers\Controller;
use Modules\Admin\Http\Models\ProgramCategory;
use Modules\University\Http\Models\Program;
use Modules\Student\Http\Models\Student;
use Modules\University\Http\Models\University;

    class FrontEndController extends Controller
    {
        /**
         * Display a listing of the resource.
         * @return Response
         */
        public function index()
        {
            return view('student::index');
        }

        /**
         * Show all programs
         */
        public function programs(){
            $categories = ProgramCategory::orderBy('catagory_name')
                ->where('status', '=', 'active');
            $programs = Program::orderBy('program_name')
                ->where([
                    ['status', '=', 'active']
                ]);
            $programs->categories = $categories;
            return view('student::program_list')
                ->withPrograms( $programs );
        }

        public function univerities()
        {
            return view('student::university_list');
        }
    }

只有第一条路线'/'才有效。当我尝试访问'/ program-search'和'/ univeristy-search'时会抛出类似"No hint path defined for [sutdent]. (View: /var/www/development/unigatenew/Modules/Student/Resources/views/university_list.blade.php)"的错误。

我在做什么错?任何人都可以帮帮忙吗?

1 个答案:

答案 0 :(得分:0)

错误是在视图中包含相同的文件名。重命名包含的文件名解决了问题。