goodyweb/jetstream-crud

Create, Read, Update, and Delete for Jetstream

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:laravel-package

dev-master 2023-12-10 09:21 UTC

This package is not auto-updated.

Last update: 2025-04-14 10:54:57 UTC


README

Laravel logo Composer logo

Jetstream CRUD

This Laravel package generates bare Livewire Components and Blade templates that would allow you to manipulate the records of a certain database table. The modules include:

  • Create
  • Read
  • Update
  • Delete
  • Search
  • Pagination

Getting started

This package makes it easy to create a full CRUD module by just issuing a single command:

php artisan generate:crud --model=Person --livewire=Persons

Voila!

See the Installation, Configuration, and Usage sections for the full details.

Installation

composer require goodyweb/jetstream-crud dev-master

Configuration

On your Livewire configuration file (config/livewire.php), set the legacy_model_binding option to true like so:

'legacy_model_binding' => true,

Important: If you don't have the config/livewire.php file, you may just create one with the default content from the raw code repository.

Usage

  1. Make a database table as you usually would:

    php artisan make:migration create_persons_table --create=persons
    • Make some edits
        <?php
      
        use Illuminate\Database\Migrations\Migration;
        use Illuminate\Database\Schema\Blueprint;
        use Illuminate\Support\Facades\Schema;
      
        return new class extends Migration
        {
            /**
            * Run the migrations.
            */
            public function up(): void
            {
                Schema::create('persons', function (Blueprint $table) {
                    $table->id();
                    // add something columns here maybe
                    $table->timestamps();
                });
            }
      
            /**
            * Reverse the migrations.
            */
            public function down(): void
            {
                Schema::dropIfExists('persons');
            }
        };
    • Execute the actual creation of the table
      php artisan migrate
  2. Make the Eloquent Model for the database table as you usually would:

    php artisan make:model Person
  3. Generate the Livewire Component and Blade template for the CRUD module:

    php artisan generate:crud --model=Person --livewire=Persons
    Parameter Argument Explanation
    model Person Person refers to the Eloquent Model that will be used for the whole CRUD module.
    livewire Persons Persons refers to the class name of the Livewire that will be generated.