定制 sajjadgozal/simple-crud 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sajjadgozal/simple-crud

Composer 安装命令:

composer require sajjadgozal/simple-crud

包简介

add simple vies of crud based apps

README 文档

README

add simple vies of crud based apps

install

install with command :

composer require sajjadgozal/simplecrud

for publishing views and config :

php artisan vendor:publish --tag=sajjadgozal\SimpleCrud\SimpleCrudServiceProvider

Uesage

Add hasCrud trait to model to enable croud routes and views for that model. And dont forget to add fillable variables.

Category model :

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use sajjadgozal\SimpleCrud\traits\hasCrud;

class Category extends Model
{
    use hasCrud;

    protected fillable = [] ;
    
}

and you can use links to work with model objects.

    {{app_address}}/{{prefix}}/{{model_name}} 

example:

    http://127.0.0.1:8000/crud/category
    
    http://127.0.0.1:8000/crud/category/1/
    
    http://127.0.0.1:8000/crud/category/1/edit
    

Configuration

route prefix can be changed from config/simplecrud.php file.

default:

    'route_prefix' => 'crud',

example:

    'route_prefix' => '',

or

    'route_prefix' => 'custom_prefix',

api prefix can be changed from config/simplecrud.php file.

    'api_route_prefix'=>'crud-api',

Views

By default, package will use view files in universal folder. you can add view files with names: "index.blade.php","show.blade.php","create.blade.php","edit.blade.php" in the folder with model name in resources/views/ folder.

example:

    resources/views/category/show.blade.php

Validation

for ading validation rules for model , add parameter rules to the model. like as laravel validation rules.

examole:

class Item extends Model
{
    use hasCrud;

    protected $fillable =[
        'name',
        'number'
    ];
    
    /**
     *  Get the validation rules that apply to the request.
     *
     * @var string[]
     */
    public $rules = [
        'name' => 'required|string',
        'number' => 'sometimes|numeric'
    ];
}

api

api routes are returning json

    {{app_address}}/{{api-prefix}}/{{model_name}} 

example:

    http://127.0.0.1:8000/crud-api/category

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固