PHP code example of songyz / laravel-simple-orm-curd

1. Go to this page and download the library: Download songyz/laravel-simple-orm-curd library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

songyz / laravel-simple-orm-curd example snippets


  Songyz\Simple\Orm\Providers\ScaffoldConfigPublishProvider::class
  

  $app->register(Songyz\Simple\Orm\Providers\ScaffoldConfigPublishProvider::class);
  

  php artisan vendor:publish --provider="Songyz\Simple\Orm\Providers\ScaffoldConfigPublishProvider" 
  

return [
    'default_page' => '', //orm默认使用的分类
    'controller_path' => base_path('app' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Controllers'), //controller存放位置
    'manager_path' => base_path('app' . DIRECTORY_SEPARATOR . 'Managers'), //manager存放位置
    'service_path' => base_path('app' . DIRECTORY_SEPARATOR . 'Services'), //service 存放位置
    'model_path' => base_path('app' . DIRECTORY_SEPARATOR . 'Models'), //model 存放位置
    'route_file' => base_path('routes' . DIRECTORY_SEPARATOR . 'api.php'), //生成curd路由存放位置
    'model_create_at'=>'created_at', //创建自动插入当前时间字段
    'model_updated_at'=>'updated_at', //更新时自动更新的时间

];


  
  Route::post('goods/getList', 'GoodsController@getList');
  Route::post('goods/del', 'GoodsController@del');
  Route::post('goods/add', 'GoodsController@add');
  Route::post('goods/update', 'GoodsController@update');
  Route::post('goods/getOne', 'GoodsController@getOne');
  
shell
  E:\phpStudy\WWW\laravel-test>php artisan songyz:scaffold
  
   请输入要生成的类名: []:
   > Goods
  
  要生成的类名是:Goods
  
   请简单描述-只支持英文: []:
   > shop
  
  描述信息信息是:shop
  
   请输入Model关联的连接 Connection: []:
   >
  
  connection:mysql
  
   请输入类对应的表名(可以为空): []:
   >
  
  Model关联的表是:goods
  E:\phpStudy\WWW\laravel-test\app\Http\Controllers\GoodsController.php 文件创建成功2478
  E:\phpStudy\WWW\laravel-test\app\Models\GoodsModel.php 文件创建成功300
  E:\phpStudy\WWW\laravel-test\app\Managers\GoodsManager.php 文件创建成功335
  E:\phpStudy\WWW\laravel-test\app\Services\GoodsService.php 文件创建成功400
  
she
  php artisan songyz:scaffold --only=services --module=Goods
  
she
  php artisan songyz:scaffold --del_module=Goods