如何访问构造函数中具有参数的控制器

时间:2016-12-21 06:21:44

标签: laravel-5.3

我的项目结构

Laravel

  • 应用

    • Customfolder

      • Customfolder1
        • Customfolder2
          • CountryInterface
    • HTTP

      • 控制器
        • RegisterController.php
  • 自举
  • 配置
  • 数据库
  • 公共

以下是RegisterController.php代码

namespace App\Http\Controllers;
use Customfolder\Customfolder1\Customfolder2\CountryInterface; 

class RegisterController extends Controller
{
     public function __construct(CountryInterface $country)
     {
           $this->country = $country;
     }

     public function postSignup(){

     }
}

从我的注册表单中,我获得了用户数据,如姓名,完整地址,电子邮件,电话等等,它将来到postSignup功能。

当我提交注册表单时,它会给我以下错误。

Class Customfolder\Customfolder1\Customfolder2\CountryInterface does not exist

以下是我的路线

路线::任何(' /注册',' RegisterController @ postSignup&#39);

以下是我的界面代码

namespace Customfolder\Customfolder1\Customfolder2;

interface CountryInterface
{
}

我的困惑是如何在构造函数有一些参数时调用控制器,其次,上述错误和可能解决方案的原因是什么?

0 个答案:

没有答案
相关问题