Download the PHP package pqrs/l5b-crud without Composer
On this page you can find all versions of the php package pqrs/l5b-crud. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pqrs/l5b-crud
More information about pqrs/l5b-crud
Files in pqrs/l5b-crud
Package l5b-crud
Short Description CRUD artisan command for rappasoft/laravel-5-boilerplate
License MIT
Homepage https://github.com/pqrs/l5b-crud
Informations about the package l5b-crud
CRUD artisan command for rappasoft/laravel-5-boilerplate
Creates a Model, Controller (with Repository, validation Requests, Events and Listeners), Migration, Routes, Breadcrumbs and CRUD Views for the given name ready to work in rappasoft/laravel-5-boilerplate backend.
From version 1.4 you can also optionally generate frontend files: Controller, Labels, Event, Request, Listener, View, Route and Repository.
By default it does not overwrite any files that may exist with the pre-stablished names. So, if you delete one of the files and run the command again, the deleted file will be created again and the rest will be ignored and will keep the changes you could have made.
Requires
It has been tested with Laravel 5.7.
Install
Run
In your Laravel project root folder:
Where example is the name you want for your model (routes, views, controllers,...). I've tried to follow best naming practices and it uses plural or singular names and lower or uppercase where needed. You can also use camelCase or snake_case.
Parameters example, Example, examples or EXAMPLES all give the same results.
Then run the created migration:
In your browser open:
...et voilà! :)
Note: out of the box, the table comes only with a title text field, besides the id, _deletedat, _createdat and _updatedat. Edit your newly created migration file to add any other you may need before runnning the migrate command.
Options
You can create all the files and run the migration by running the command with the --migrate option:
You may also specify the name of the default text field 'title' to whatever other you prefer with the --field option:
You can also overwrite previously created files with the --force option.
To generate the frontend files also, you should use the --frontend option.
Include a menu item
A file named sidebar-examples.blade.php is created in the folder /resources/views/backend/example/includes. It contains the html code for a menu item to access your recently created views. You can show it in your sidebar by including the following line in /resources/views/backend/includes/sidebar.blade.php wherever you want it to appear:
Events and Listeners
The package generates three events and listeners for creating, updating and deleting items methods. In order to get these to work you must resgister them with the event dispatcher, adding this line to your Providers/EventServiceProvider.php file (under Backend Subscribers):
Language lines
Customized English language lines can be found /resources/lang/en. There is a file for backend lines (backend_examples.php) and another for frontend (frontend_examples.php).
Backend Files created
Model
Trait Attribute
This is where the action buttons for the new object are.
Controller
It contains the CRUD methods: index, create, store, show, edit, update, destroy, delete, restore and deleted.
Repository
Contains database logic.
Requests
Validation manage, store and update Requests.
Events
Listeners
Migrations
Routes
Contains the named routes admin.examples.index, admin.examples.deleted, admin.examples.restore, delete-permanently, admin.examples.create, admin.examples.store, admin.examples.show, admin.examples.edit, admin.examples.update and admin.examples.destroy.
Breadcrumbs
This has the breadcrumbs for the routes admin.examples.index, admin.examples.create, admin.examples.show, admin.examples.edit and admin.examples.deleted.
The following line is added to routes/breadcrumbs/backend/backend.php:
If you delete the routes/breadcrumbs/backend/example.php file created by this command, don't forget to delete this line or your whole project will crash.
Views
If you add more fields to your datatable, you'll have to edit show.blade.php, create.blade.php and edit.blade.php to suit your needs.
Menu item
HTML code for the menu item for your Laravel 5 Boilerplate sidebar.
Fronted Files created
Controller
It contains the CRUD methods: index, create, store, show, edit, update, destroy, delete, restore and deleted.
Repository
Contains database logic.
Requests
Validation manage, store and update Requests.
Events
Listeners
Routes
Contains the named routes examples.index, examples.deleted, examples.restore, delete-permanently, examples.create, examples.store, examples.show, examples.edit, examples.update and examples.destroy.
Views
If you add more fields to your datatable, you'll have to edit show.blade.php, create.blade.php and edit.blade.php to suit your needs.
Changes
- 1.4 Added language lines files. Added options for frontend file generation and force overwriting of previous files. Thanks @rabol for your contribution.
- 1.3.8 Modified README.md about adding Listener to EventServiceProvider.php.
- 1.3.7 Added event firing to controller methods.
- 1.3.6 Added Events and Listeners for Create, Update and Delete operations.
- 1.3.5 Added --field option to specify the name of the default field
License
This repository is open-sourced software licensed under the MIT license.
Copyright © 2019 Alvaro Piqueras [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Laravel Copyright © 2019 Taylor Otwell
Laravel 5 Boilerplate Copyright © 2019 Anthony Rappa [email protected]