Daily laravel-20160702| Cachetablecommand

Source: Internet
Author: User

<?phpnamespace illuminate\cache\console;use illuminate\console\command;use illuminate\ Support\composer;use illuminate\filesystem\filesystem;// a namespace like folder  ,so enoughclass cachetablecommand extends command{// a cache table  Command  a son class of father    /**      * The console command name.     *      *  @var  string     */    protected   $name  =  ' cache:table ';// the console command name.   //  a console command    /**     * The  console command description.     *     *  @var  string     */    protected  $description  =  ' create a migration for  The cache database table ';// a description   // the console  command description.    /**     * The  filesystem instance.     *     *  @var  \ illuminate\filesystem\filesystem     */    protected  $files ;// the filesystem instance.    /**     * @ var \illuminate\support\composer     */    protected $ composer;// a commposer instance    /**     *  Create a new session table command instance.      *     *&nbsp, @param   \Illuminate\Filesystem\Filesystem   $files      *   @param   \Illuminate\Support\Composer   $composer      *  @return  void     */   // create a new session  table command instance.    public function __construct ( filesystem  $files, composer  $composer)     {         parent::__construct ();// use parent construct function          $this->files =  $files;// a file to set          $this->composer =  $composer;// a composer  instance    }    /**     * execute  the console command.     *     *  @return  void      */    public function fire ()// fire like start,or  run or execute the console command    {          $fullPath  =  $this->createbasemigration ();// create base  Migration[move]         $this->files->put ($fullPath,  $ This->files->get (__dir__. ' /stubs/cache.stub '));// form the file cache to save the value to  the table         $this->info (' migration created  successfully! '); / log info         $this->composer->dumpautoloads ();//  user composer api function .    }&nbsP;   /**     * create a base migration file  for the table.     *     *  @return  string     */    protected function  Createbasemigration ()// create a base migration file for the table.     {         $name  =  ' create_cache_table ';// a name create_cache_table         $path  =   $this->laravel->databasepath (). ' /migrations ';// has a databasepath ()         return   $this->laravel[' Migration.creator ']->create ($name,  $path);     }// a  base full function}


This article is from the "Focus on PHP" blog, please be sure to keep this source http://lijinghsan.blog.51cto.com/3357095/1761166

Daily laravel-20160702| Cachetablecommand

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.