app/Console/Commands/crud.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $name = $this->argument('name');
        $title = $this->argument('title');
        $this->controller($name,$title);
        $this->service($name,$title);
        $this->model($name,$title);
        $this->request($name,$title);
        $this->viewIndex($name);
        $this->Api($name,$title);
        $this->ApiJs($name,$title);
        $this->Js($name,$title);
        $this->Apicontroller($name,$title);
        $this->migrations($name,$title);
        $show_add_edit_del=[
            ['name'=>'show '.strtolower(Str::plural(Str::snake($name))), 'title'=>$title.'查看'],
            ['name'=>'create '.strtolower(Str::plural(Str::snake($name))), 'title'=>$title.'添加'],
            ['name'=>'edit '.strtolower(Str::plural(Str::snake($name))), 'title'=>$title.'修改'],
            ['name'=>'delete '.strtolower(Str::plural(Str::snake($name))), 'title'=>$title.'删除'],
        ];
        $this->webRoute($name,$title);
    }
public function handle ( ) { $ name = $ this -> argument ( 'name' ) ; $ title = $ this -> argument ( 'title' ) ; $ this -> controller ( $ name , $ title ) ; $ this -> service ( $ name , $ title ) ; $ this -> model ( $ name , $ title ) ; $ this -> request ( $ name , $ title ) ; $ this -> viewIndex ( $ name ) ; $ this -> Api ( $ name , $ title ) ; $ this -> ApiJs ( $ name , $ title ) ; $ this -> Js ( $ name , $ title ) ; $ this -> Apicontroller ( $ name , $ title ) ; $ this -> migrations ( $ name , $ title ) ; $ show_add_edit_del = [ [ 'name' => 'show ' . strtolower ( Str :: plural ( Str :: snake ( $ name ) ) ) , 'title' => $ title . '查看'], [ 'name' => 'create ' . strtolower ( Str :: plural ( Str :: snake ( $ name ) ) ) , 'title' => $ title . '添加'], [ 'name' => 'edit ' . strtolower ( Str :: plural ( Str :: snake ( $ name ) ) ) , 'title' => $ title . '修改'], [ 'name' => 'delete ' . strtolower ( Str :: plural ( Str :: snake ( $ name ) ) ) , 'title' => $ title . '删除'], ] ; $ this -> webRoute ( $ name , $ title ) ; }
Execute the console command.
Execute the console command .
//        //将当前添加的权限添加给超级管理员 //        $super_admin = Role::where('id', '=', 1)->firstOrFail(); //将输入角色匹配 //        //将当前添加的权限添加给企划 //        $layout_admin = Role::where('id', '=', 2)->firstOrFail(); //将输入角色匹配 //        foreach ($show_add_edit_del as $v){ //            $permission=Permission::create($v); //            $permission->syncRoles([$super_admin,$layout_admin]); //        } //        File::append(base_path('routes/web.php'), PHP_EOL.'/*-----------------------------'.$title.'-----------------------------*/'.PHP_EOL.'$router->resource(\'' . strtolower(Str::plural(Str::snake($name))) . "', '{$name}Controller', ['only' => ['index', 'create', 'store', 'update', 'edit', 'destroy']]);").PHP_EOL;