Download the PHP package dlogon/quick-crud-for-laravel without Composer
On this page you can find all versions of the php package dlogon/quick-crud-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dlogon/quick-crud-for-laravel
More information about dlogon/quick-crud-for-laravel
Files in dlogon/quick-crud-for-laravel
Package quick-crud-for-laravel
Short Description Create a crud for model in some steps
License MIT
Homepage https://github.com/dlogon/quick-crud-for-laravel
Informations about the package quick-crud-for-laravel
Create a crud for model in some steps
Create a Crud for model in some steps
Requirements
This package uses TailwindCSS (https://tailwindcss.com/) for styling. It uses some of the base laravel breeze/jetstream components and styles.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Optionally, you can publish the views using
Usage
Once you have created your model and running the migrations, you can run the command
This will create:
-A Controller named \<your model name>Controller
-A view named index inside views/crudable/\<your model in lower case>/index.blade.php
-A view named show inside views/crudable/\<your model in lower case>/show.blade.php
-A route file named quickcrud.php
Then you should add the trait Dlogon\QuickCrudForLaravel\Traits\NavigationUtils;
to your model, for example:
Then you should include the quickcrud.php file in your web.php route file, o copy the generated routes in web.php
With this steps, you are now able to navigate to yourhost/\
If your model is in another namespace than the default App/Models/
you can pass a second argument with the namespace
Example:
We generate the Blog model with this migration
Then we run the migrations, and we run
this will create the next controller in the controller folder
and the index and show views.
table fields
We have a table
component inside the recent created index view, connected to the $tablefields
controller variable.
We should pass an asoc array with the key as the label column displayed in the table component and the value as the column name in our database model.
Example:
You can alternatively pass an array instead the database-model-column, if you do this, you should pass the type and field structure.
If you set the type as related, you should put in field relationName.fieldName
where fieldName is the column name in the related model
Example:
If you set the type as money, you should put the numeric field in the field key of array
Example:
search fields
By default the variable controller $searchfields
has the created_at field for search, you can define the next 3 structures for a search field
Text
where
- fieldName: is the column name in your model
- type: the type of search defined as text
- placeholder: What to display in the text input
Date
where
- fieldName: is the datetime column name in your model
- type: the type of date
- label: is what the label show aside the input date
Related
This will show a dropdown for a seach of related models
where
- fieldName: the foreign key contained in your current model
- type: the type of related
- elements: the related models for a search, for example if you generate a Invoice quickcrud, and you want to search the invoices related to costumer, you should put here Customer::all()
- modelDisplay: what field of the related model you want to display
- label: is what the label show aside the input dropdown
- value: the related column in the related model search for
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Diego Lopez
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of quick-crud-for-laravel with dependencies
spatie/laravel-package-tools Version ^1.14.0
dlogon/tailwind-alerts Version ^0.2