This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HTTP Basic Authentication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git 修改.gitignore后生效 | |
| git rm -r --cached . #清除缓存 | |
| git add . #重新trace file | |
| git commit -m "update .gitignore" #提交和注释 | |
| git push origin master #可选,如果需要同步到remote上的话 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @if (session('status')) | |
| <div class="alert alert-success"> | |
| {{ session('status') }} | |
| </div> | |
| @endif | |
| {{ csrf_field() }} | |
| @if ($errors->has('cate')) | |
| <span class="invalid-feedback"> | |
| <strong>{{ }}</strong> | |
| </span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tar -czvf name-of-archive.tar.gz /path/to/directory-or-file | |
| Here’s what those switches actually mean: | |
| -c: Create an archive. | |
| -z: Compress the archive with gzip. | |
| -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful. | |
| -f: Allows you to specify the filename of the archive. | |
| tar -czvf archive.tar.gz /home/ubuntu --exclude=/home/ubuntu/Downloads --exclude=/home/ubuntu/.cache | |
| tar -czvf archive.tar.gz /home/ubuntu --exclude=*.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Add an Existing User Account to a Group | |
| usermod -a -G examplegroup exampleusername | |
| usermod -a -G sudo geek | |
| //Change a User’s Primary Group | |
| usermod -g groupname username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| factory(App\User::class, 100)->create()->each(function($u) { | |
| $u->profile()->save(factory(App\Models\Profile::class)->make()); | |
| $u->wx()->save(factory(App\Models\Wx::class)->make()); | |
| for( $i=0; $i<rand(0, 100); $i++){ | |
| $u->stats()->save(factory(App\Models\Stat::class)->make()); | |
| } | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tree -L 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Laravel 手动返回错误码 | |
| 设想到一个情景,如果新增数据库时用户提交的数据正确,也就是通过了验证,但是添加数据库时发生错误,比如: | |
| if(!$users->save()){ | |
| //新增数据库时发生错误 | |
| } | |
| 那么需要返回错误信息,这个时候怎么手动呢?找到了一个函数,特此记录,感觉够用了: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| var _token = '{{csrf_token()}}'; | |
| $.ajaxSetup({ | |
| headers: { | |
| 'X-CSRF-TOKEN': _token | |
| } | |
| }); | |
| </script> | |
| 接下来就可以把错误信息提取出来了。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| composer clear-cache | |
| 按照 中文镜像 配置全局镜像: | |
| composer config -g repo.packagist composer https://packagist.laravel-china.org | |
| 再次尝试: | |
| composer create-project laravel/laravel Laravel --prefer-dist "5.1.*" |