flightsadmin / livewire-crud

Generate Complete Livewire CRUD Including Component, Model, Views and Factories from database tables
MIT License
75 stars 31 forks source link

Routes? #6

Closed alrik11es closed 1 year ago

alrik11es commented 1 year ago

I've been messing with this crud generator. I've struggled to get routes working. How about suggest the user some route configs? Or just point to the way to use the CRUD results.

georgechitechi commented 1 year ago

When you run php artisan crud:install below Auth routes will be added to the routes file if you choose to Install Auth. If you dont install Auth, Below will not be added. This is from laravel/ui package

//Route Hooks - Do not delete// Auth::routes(); Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

When you run php artisan crud:generate posts below Routes are added to the below //Route Hooks - Do not delete//

Route::view('posts', 'livewire.posts.index')->middleware('auth');

image

Let me know if above helps.

alrik11es commented 1 year ago

Thanks for adding some examples. Strangely it didn't get populated when I ran the command. It seems there is some problem there.

georgechitechi commented 1 year ago

Can you run below command and advise if still issues; Just to test on a new Project, because I did and it worked as expected. Please create and migrate posts migration file before running last command, or create any table of your choice in the database. Run composer create-project laravel/laravel:8 myapp to create laravel 8 project.

composer create-project laravel/laravel myapp

composer require flightsadmin/livewire-crud

php artisan crud:install

php artisan crud:generate posts 
alrik11es commented 1 year ago

Oh! I forgot to run php artisan crud:install.

Thanks for the help.