Laravel 5.6 中文文档*/ protected $headers = Request::HEADER_X_FORWARDED_ALL; } 注:如果你在使用 AWS Elastic Load Balancing,headers 值应该修改为 Request::HEADER_X_FORWARDED_AWS_ELB,关于 headers 属性可用的更多 常量,请查看 Symfony 信任代理文档。 App\Book::all(); if ($someCondition) { $books->load('author', 'publisher'); } 如果你需要设置更多的查询条件到渴求式加载查询上,可以传递一个包含你想要记载的关联关系数组到 load 方法,数组的值应该是接收查询实例的 闭包: $books->load(['author' => function ($query) { $ 你还可以在路由或控制器中构造资源类实例时添加顶层数据,在所有资源类中都有效的 additional 方法,可用于添加数组数据到资源响应: return (new UserCollection(User::all()->load('roles'))) ->additional(['meta' => [ 'key' => 'value',0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 6.0 中文文档com 269 */ protected $headers = Request::HEADER_X_FORWARDED_A LL; } 注:如果你在使用 AWS Elastic Load Balancing, headers 值应该修改 为 Request::HEADER_X_FORWARDED_AWS_ELB,关 于 headers 属性可用的更多常量,请查看 Symfony 信 想要了解更多,查看 Symfony 进度条组件文档。 注册命令 由于 Console Kernel 的 commands 方法会调用 load 方法,所 有 app/Console/Commands 目录下的命令都会通过 Artisan 自动注 册。实际上,你可以额外调用 load 方法来遍历其他目录下的 Artisan 命令: 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资 the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); $this->load(__DIR__.'/MoreCommands'); // ... } 此外,还可以在 app/Console/Kernel.php 类的 $commands0 码力 | 1442 页 | 14.66 MB | 1 年前3
CakePHP Cookbook Documentation 5.x) Controller::fetchTable() Paginating a Model Controller::paginate() Configuring Components to Load Controller::loadComponent() Request Life-cycle Callbacks Event List Controller Callback Methods etc. The model objects can be thought of as “Friend”, “User”, “Comment”, or “Photo”. If we wanted to load some data from our users table we could do: use Cake\ORM\Locator\LocatorAwareTrait; $users = $t first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 1080 页 | 939.39 KB | 1 年前3
CakePHP Cookbook 3.x
Same Controller Loading Additional Models Paginating a Model Configuring Components to Load Configuring Helpers to Load Request Life-cycle Callbacks Event List Controller Callback Methods More on Controllers etc. The model objects can be thought of as “Friend”, “User”, “Comment”, or “Photo”. If we wanted to load some data from our users table we could do: use Cake\ORM\TableRegistry; // Prior to 3.6 use Tab first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 1244 页 | 1.05 MB | 1 年前3
CakePHP Cookbook 3.x
. . . . . . 292 Configuring Components to Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Configuring Helpers to Load . . . . . . . . . . . . . . . . . . . . . etc. The model objects can be thought of as “Friend”, “User”, “Comment”, or “Photo”. If we wanted to load some data from our users table we could do: use Cake\ORM\TableRegistry; (continues on next page) first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 967 页 | 2.80 MB | 1 年前3
CakePHP Cookbook Documentation 5.x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Configuring Components to Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Request Life-cycle etc. The model objects can be thought of as “Friend”, “User”, “Comment”, or “Photo”. If we wanted to load some data from our users table we could do: use Cake\ORM\Locator\LocatorAwareTrait; (continues on first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 848 页 | 2.53 MB | 1 年前3
CakePHP Cookbook 4.x
) Controller::fetchTable() Paginating a Model Controller::paginate() Configuring Components to Load Controller::loadComponent() Request Life-cycle Callbacks Event List Controller Callback Methods etc. The model objects can be thought of as “Friend”, “User”, “Comment”, or “Photo”. If we wanted to load some data from our users table we could do: use Cake\ORM\Locator\LocatorAwareTrait; $users = $t first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 1249 页 | 1.04 MB | 1 年前3
CakePHP Cookbook 4.x
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Configuring Components to Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Request Life-cycle etc. The model objects can be thought of as “Friend”, “User”, “Comment”, or “Photo”. If we wanted to load some data from our users table we could do: use Cake\ORM\Locator\LocatorAwareTrait; (continues on first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 967 页 | 2.88 MB | 1 年前3
CakePHP Cookbook 2.x
around an issue in Composer’s autoloader. In your Config/bootstrap.php file add the following: // Load Composer autoload. require APP . 'Vendor/autoload.php'; // Remove and re-prepend CakePHP's autoloader important. // See: http://goo.gl/kKVJO7 spl_autoload_unregister(array('App', 'load')); spl_autoload_register(array('App', 'load'), true, true); You should now have a functioning CakePHP application installed first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 1096 页 | 958.62 KB | 1 年前3
CakePHP Cookbook 2.x
around an issue in Composer’s autoloader. In your Config/bootstrap.php file add the following: // Load Composer autoload. require APP . 'Vendor/autoload.php'; // Remove and re-prepend CakePHP's autoloader important. // See: http://goo.gl/kKVJO7 spl_autoload_unregister(array('App', 'load')); spl_autoload_register(array('App', 'load'), true, true); You should now have a functioning CakePHP application installed first. Answers may come slower, but will remain longer – and you’ll also be lightening our support load. Both the manual and the API have an online component. The Bakery https://bakery.cakephp.org The0 码力 | 820 页 | 2.52 MB | 1 年前3
共 70 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













