Laravel 5中的注册服务机构在哪里? [英] Where is the Registrar Services in Laravel 5?

查看:48
本文介绍了Laravel 5中的注册服务机构在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用户表中添加了几个字段,在我读过的每个表中都说我还需要更新app/Services/Registrar.php文件中的新字段.但是我在任何地方都找不到Services文件夹!这是Laravel 5中的新安装,这是我的目录结构的屏幕截图:

I added couple of fields to my user table and everywhere I read it said I also need to update the new fields in the app/Services/Registrar.php file. But I cannot find the Services folder anywhere! This is a new installation in Laravel 5 and here is the screen shot of my directory structure:

服务"文件夹发生了什么?测试时,我可以看到User::create()可以正常工作,但是我不知道它的声明位置,因为找不到Registrar.php文件.

What happened to the Services Folder? When I test, I can see that the User::create() works but I dont know where its declared since I cant find the Registrar.php file.

推荐答案

我在用户表中添加了几个字段,在我读过的每个表中都说我还需要更新app/Services/Registrar.php文件中的新字段.

I added couple of fields to my user table and everywhere I read it said I also need to update the new fields in the app/Services/Registrar.php file.

在Laravel 5.1中已将其删除.

This was removed in Laravel 5.1.

http://laravel.com/docs/master/upgrade#upgrade- 5.1.0

第二,不再需要Laravel 5.0中使用的App\Services\Registrar类.您可以简单地将此类的验证器复制并粘贴到该类中,然后将其直接创建到您的AuthController中.无需对这些方法进行其他更改;但是,应确保在AuthController的顶部导入Validator门面和User模型.

Secondly, the App\Services\Registrar class used in Laravel 5.0 is no longer needed. You can simply copy and paste your validator and create method from this class directly into your AuthController. No other changes should need to be made to these methods; however, you should be sure to import the Validator facade and your User model at the top of your AuthController.

这篇关于Laravel 5中的注册服务机构在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆