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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$collection = collect(range(1, 9));

$chunks = $collection->chunk(2);

$labeld = $chunks->mapSpread(function ($odd, $even) {
return "Odd: {$odd} Even: {$even}";
});

$numbers = collect([3, 5, 7]);
$words = collect(['three', 'five', 'seven']);

$results = $numbers->zip($words)
->mapSpread(function ($number, $word) {
return $number . '=' . $word;
});

dd($labeld->toArray(), $results->toArray());
x
0%