redbastie/crudify 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

redbastie/crudify

Composer 安装命令:

composer require redbastie/crudify

包简介

A Laravel 8 CRUD package for rapid scaffolding and development.

README 文档

README

This package is no longer maintained. Please consider my latest package here: https://github.com/redbastie/tailwire

Crudify

Crudify is a Laravel 8 CRUD package which promotes rapid scaffolding and development. It uses a tried and true stack and intuitive techniques that will save you time and hassles.

Requirements

  • A server compatible with Laravel 8
  • Composer
  • NPM

Features

  • Automatic user timezones
  • AJAX forms, modals, and response handlers
  • Responsive data tables
  • Font Awesome icons
  • Sensible Bootstrap styling out of the box
  • CRUD generator command (make:crud)
  • Automatic migrations command (migrate:auto)
  • Migration, factory, and rule definitions inside models
  • Automatic routing based on controller methods
  • Dynamic model fillables
  • & more

Third Party Packages Used

Links

Installation

Crudify was designed to work with a clean Laravel 8 install.

Install Laravel:

laravel new vehicle-app

Configure the database in your .env file:

DB_DATABASE=vehicle_app
DB_USERNAME=root
DB_PASSWORD=

Now, install Crudify via composer:

composer require redbastie/crudify

Then, run the Crudify install command:

php artisan crudify:install

All done. The only thing left to do is create a user, either via tinker or the DatabaseSeeder.

Usage Example

Generate CRUD for a new model e.g. a Vehicle

php artisan make:crud Vehicle

This will generate your controller, data table, model, factory, views, nav item, and auto route.

Modify the migration method inside the new Vehicle model class:

public function migration(Blueprint $table)
{
    $table->id();
    $table->timestamps();
    $table->string('name');
    $table->string('brand');
}

You can also specify the factory definition and rules in the model:

public static function definition(Generator $faker)
{
    return [
        'name' => $faker->name,
        'brand' => $faker->company,
    ];
}

public static function rules(Vehicle $vehicle = null)
{
    return [
        'name' => ['required', Rule::unique('vehicles')->ignore($vehicle->id ?? null)],
        'brand' => ['required'],
    ];
}

Specify a Vehicle seeder in the DatabaseSeeder class:

\App\Models\User::factory()->create([
    'email' => 'admin@example.com',
]);

\App\Models\Vehicle::factory(100)->create();

Note that I've added a User seeder here as well, which we will use to log in with using the password password after.

Add some data table columns in the VehicleDataTable class:

protected function getColumns()
{
    return [
        Column::make('id'),
        Column::make('name'),
        Column::make('brand'),
        Column::make('created_at'),
        Column::computed('action')->title(''),
    ];
}

Add form fields in the vehicles/form.blade.php view file:

<x-form-input label="{{ __('Name') }}" name="name"/>
<x-form-input label="{{ __('Brand') }}" name="brand"/>

Run a fresh automatic migration command with seeding:

php artisan migrate:auto --fresh --seed

You can specify --fresh and/or --seed in the migrate:auto command in order to run fresh migrations and/or seed afterwards.

Now you should be able to login to your app and click on the Vehicles link in the navbar to perform CRUD operations on the seeded data.

To get an idea how the automatic routing works, check out the VehicleController. After updating controller methods, use php artisan route:list to see your route info.

redbastie/crudify 适用场景与选型建议

redbastie/crudify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 428 次下载、GitHub Stars 达 15, 最近一次更新时间为 2020 年 09 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 redbastie/crudify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 redbastie/crudify 我们能提供哪些服务?
定制开发 / 二次开发

基于 redbastie/crudify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 15
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-24