0%

1
2
3
4
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';

config('any');
x

解决办法:

1
2
3
4
5
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';

(new \Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app);
config('any');

使用 (new \Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app); 加载配置

ServiceProvider 里面加上

1
app('view')->addLocation(module_path('Develop') . '/resources/views');

zsh 命令补全插件

zsh-users/zsh-autosuggestions

x

laravel5(使用前提:安装了 oh-my-zsh

x

使用方法,修改 ~/.zshrc,在 plugins 里面加一行 laravel5,然后运行 source ~/.zshrc

主要用处:在输入 artisan 的时候可以自动进行命令补全(包括自定义的一些命令)

源码

x

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

require __DIR__ . '/bootstrap/app.php';

$arr = [
[
'name' => 'John',
'age' => 23
],
[
'name' => 'Neo',
'age' => 25
],
[
'name' => 'John',
'age' => 24
]
];

$v = collect($arr)->mapToDictionary(function ($v) {
// 主要作用: 可以自定义每一项的 key value
return [$v['name'] => $v];
})->toArray();

// $v 与 $v1 相等
$v1 = collect($arr)->groupBy('name')->toArray();

dd($v);

输出

x