Laravel 5.1 中文文档里,中间件可以接受额外的自定义参数,例如,如果你的应用需要在执行给定 的 action 之前验证被授予指定“角色”的认证用户,可以创建一个 RoleMiddleware 来接收角 色名称作为额外参数: namespace App\Http\Middleware; use Closure; class RoleMiddleware { /** * 运行请求过滤器. vendor 包发布语言文件的默认目录做了移动,所有 vendor 包语言文件从 resources/lang/packages/{locale}/{namespace}移动到了 resources/lang/vendor/{namespace}/{locale}目录。例如,Acme/Anvil 包的 acme/anvil::foo 英语语言文件将会从 resources/lang/pack 另一个通用的例子是路由群组分配同一个 PHP 命名空间给多个控制器,可以在群组属性数 组中使用 namespace 参数来指定群组中控制器的命名空间: 本文档由 Laravel 学院(LaravelAcademy.org)提供 22 Route::group(['namespace' => 'Admin'], function(){ // Controllers Within0 码力 | 307 页 | 3.46 MB | 1 年前3
CakePHP Cookbook 3.x
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943 PHP Namespace Index 947 Index 949 viii CHAPTER 1 CakePHP at a Glance CakePHP is designed to make common web-development found in a file named BestEverHelper.php Each file would be located in the appropriate folder/namespace in your app folder. 8 Chapter 1. CakePHP at a Glance CakePHP Cookbook Documentation, Release 3 This makes the name semantically related on the framework it depends on. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use0 码力 | 967 页 | 2.80 MB | 1 年前3
CakePHP Cookbook Documentation 5.x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826 PHP Namespace Index 829 Index 831 viii CHAPTER 1 CakePHP at a Glance CakePHP is designed to make common web-development found in a file named BestEverHelper.php Each file would be located in the appropriate folder/namespace in your app folder. 8 Chapter 1. CakePHP at a Glance CakePHP Cookbook Documentation, Release 5 This makes the name semantically related on the framework it depends on. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use0 码力 | 848 页 | 2.53 MB | 1 年前3
Laravel 5.2 中文文档命名空间给其下的多个控制器,可以在分 组属性数组中使用 namespace 来指定群组中所有控制器的公共命名空间: Route::group(['namespace' => 'Admin'], function(){ // 控制器在 "App\Http\Controllers\Admin" 命名空间下 Route::group(['namespace' => 'User'], function(){ 保护中排 除 webhook 处理器路由。 要实现这一目的,你需要在 VerifyCsrfToken 中间件中将要排除的 URL 添加 到 $except 属性: namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; app/Http/Middleware 目录下创建一个新的中间件类 OldMiddleware,在这 个中间件中,我们只允许提供的 age 大于 200 的访问路由,否则,我们将用户重定向到主 页: namespace App\Http\Middleware; use Closure; class OldMiddleware { /** * 返回请求过滤器0 码力 | 377 页 | 4.56 MB | 1 年前3
CakePHP Cookbook 4.x
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942 PHP Namespace Index 947 Index 949 viii CHAPTER 1 CakePHP at a Glance CakePHP is designed to make common web-development found in a file named BestEverHelper.php Each file would be located in the appropriate folder/namespace in your app folder. 8 Chapter 1. CakePHP at a Glance CakePHP Cookbook Documentation, Release 4 This makes the name semantically related on the framework it depends on. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use0 码力 | 967 页 | 2.88 MB | 1 年前3
Laravel 5.6 中文文档OrderChannel::class); 最后,可以将频道的授权逻辑放到频道类的 join 方法。join 方法中的代码等同于之前位于频道授权闭包中的处理逻辑。当然,你还可以使用频道模 型绑定: namespace App\Broadcasting; use App\User; use App\Order; class OrderChannel { /** * Create htmlspecialchars 函数的默认行为保持一致。如果 你想要维持不进行双重编码的旧状,可以使用 Blade::withoutDoubleEncoding 方法: namespace App\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; Bootstrap 3 链接,需要在 AppServiceProvider 的 boot 方法中调 用 Paginator::useBootstrapThree 方法: namespace App\Providers; use Illuminate\Pagination\Paginator; use Illuminate\Support\ServiceProvider;0 码力 | 377 页 | 14.56 MB | 1 年前3
CakePHP Cookbook 3.x
found in a file named BestEverHelper.php Each file would be located in the appropriate folder/namespace in your app folder. Database Conventions Table names corresponding to CakePHP models are plural This makes the name semantically related on the framework it depends on. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use ble.php. The completed file should look like this: namespace App\Model\Table; use Cake\ORM\Table; class ArticlesTable extends Table { public function initialize(array0 码力 | 1244 页 | 1.05 MB | 1 年前3
CakePHP Cookbook Documentation 5.xfound in a file named BestEverHelper.php Each file would be located in the appropriate folder/namespace in your app folder. Database Conventions Table names corresponding to CakePHP models are plural This makes the name semantically related on the framework it depends on. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use Useful to prefix a CakePHP plugin with “cakephp-” in the package name. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use0 码力 | 1080 页 | 939.39 KB | 1 年前3
CakePHP Cookbook 4.x
found in a file named BestEverHelper.php Each file would be located in the appropriate folder/namespace in your app folder. Database Conventions Table names corresponding to CakePHP models are plural This makes the name semantically related on the framework it depends on. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use Useful to prefix a CakePHP plugin with “cakephp-” in the package name. Do not use the CakePHP namespace (cakephp) as vendor name as this is reserved to CakePHP owned plugins. The convention is to use0 码力 | 1249 页 | 1.04 MB | 1 年前3
Laravel 5.3 中文文档驱动,不 过,编写自己的驱动很简单,你可以通过自己的搜索实现扩展 Scout。 你可以简单通过添加 Searchable trait 到模型让模型变得可搜索: namespace App; use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; class Post 方法。 User 模型必须使用新的 Illuminate\Notifications\Notifiabletrait 以便邮件重置链接可以正常 发送: namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; 仍然有替代方案,那就是在控制器构造函数中使用 Closure 来直接定义中间件。请注意,在使用 这个方案的时候,确保你所使用的 Laravel 版本高于 5.3.4: namespace App\Http\Controllers; use App\User; use Illuminate\Support\Facades\Auth; use App\Http\0 码力 | 691 页 | 9.37 MB | 1 年前3
共 64 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













