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
    
  
  
    
  | ##format and mount HD | |
| ###check if there are HD | |
| fdisk -l | |
| ###partition | |
| fdisk /dev/vdb | |
| ###format | |
| mkfs.ext3 /dev/vdb1 | 
  
    
      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
    
  
  
    
  | ##setup vsftpd | |
| ###install vsftpd | |
| sudo apt update | |
| sudo apt install vsftpd | |
| ###add user | |
| useradd ftpuser -p <password> -g ftp -d /var/www -s bin/false | |
| //user home | |
| sudo usermod -d /var/www ftpuser | |
| sudo usermod -G www-data ftpuser //将用户ami8加入到www-data群中 | |
| chmod -R ug+rw /home/ftpfolder | 
  
    
      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
    
  
  
    
  | "repositories": { | |
| "packagist": { | |
| "type": "composer", | |
| "url": "https://packagist.phpcomposer.com" | |
| } | |
| } | 
  
    
      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
    
  
  
    
  | $ npm install -g cnpm --registry=https://registry.npm.taobao.org | |
| 或者你直接通过添加 npm 参数 alias 一个新命令: | |
| alias cnpm="npm --registry=https://registry.npm.taobao.org \ | |
| --cache=$HOME/.npm/.cache/cnpm \ | |
| --disturl=https://npm.taobao.org/dist \ | |
| --userconfig=$HOME/.cnpmrc" | |
| # Or alias it in .bashrc or .zshrc | |
| $ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \ | 
  
    
      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
    
  
  
    
  | //远程建立空库 | |
| mkdir repos | |
| cd repos | |
| git init --bare --shared site.git | |
| cd /var/www/web | |
| //网站如果会在 /var/www/web下 | |
| git clone /var/www/web/repos/site.git site | 
  
    
      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 init | |
| git config --global user.name "Your Name" | |
| git config --global user.email "Your Email Address" | |
| git config --global color.ui auto | |
| git remote add origin https://github.com/LearningLaravel/Laravel.git | |
| git push -u origin master | |
| //提交远程新分支 | |
| git push --set-upstream origin dev | |
| //下载无关分支 | 
  
    
      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
    
  
  
    
  | Create a Facebook Test App | |
| After creating your Facebook app, you can connect it to your Laravel app by simply editing the | |
| config/services.php file. Add this: | |
| 1 'facebook' => [ | |
| 2 'client_id' => 'yourFacebookAppID', | |
| 3 'client_secret' => 'yourFacebookAppSecret', | |
| 4 'redirect' => 'http://yourLaravelAppURL/login/facebook/callback', | |
| 5 ], | |
| Open database/migrations/timestamps_create_users_table.php file and update the up method: | |
| 1 public function up() | 
  
    
      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
    
  
  
    
  | Redirecting Unauthenticated Users | |
| When the auth middleware detects an unauthorized user, it will either return a JSON 401 response, or, if the request was not an AJAX request, redirect the user to the login named route. | |
| You may modify this behavior by defining an unauthenticated function in your app/Exceptions/Handler.php file: | |
| use Illuminate\Auth\AuthenticationException; | |
| protected function unauthenticated($request, AuthenticationException $exception) | |
| { | |
| return $request->expectsJson() | 
  
    
      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
    
  
  
    
  | Manually Authenticating Users | |
| Of course, you are not required to use the authentication controllers included with Laravel. If you choose to remove these controllers, you will need to manage user authentication using the Laravel authentication classes directly. Don't worry, it's a cinch! | |
| We will access Laravel's authentication services via the Auth facade, so we'll need to make sure to import the Auth facade at the top of the class. Next, let's check out the attempt method: | |
| <?php | |
| namespace App\Http\Controllers; | |
| use Illuminate\Http\Request; | 
  
    
      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
    
  
  
    
  | Remembering Users | |
| If you would like to provide "remember me" functionality in your application, you may pass a boolean value as the second argument to the attempt method, which will keep the user authenticated indefinitely, or until they manually logout. Of course, your users table must include the string remember_token column, which will be used to store the "remember me" token. | |
| if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) { | |
| // The user is being remembered... | |
| } | |
| If you are using the built-in LoginController that is shipped with Laravel, the proper logic to "remember" users is already implemented by the traits used by the controller. | |
| If you are "remembering" users, you may use the viaRemember method to determine if the user was authenticated using the "remember me" cookie: |