Cray is a disposable Laravel package to help you generate nearly complete CRUD pages like crazy. Literally. It's also a bit opinionated.
If you build straight-forward CRUD pages more often manually writing all the same logic becomes a chore. Cray will not only save you a save but also give you a better way to organize your code.
You use Cray and forget about it. It isn't coupled with your installation of Laravel and it is preferred to be installed as a dev dependency. Cray generates the files and it forgets about them and they are all yours to modify do whatever you want.
Suppose you are building a blog, and you want to create a Post model then you have to do a ton of other tedious and to be honest, boring things like creating migrations, model factories, the controller, form validation and adding all the logic and what not.
So what Cray does is when you tell it the model name, it will do all those boring things I listed earlier. When it's done you have the following:
Post.phpPostController.phpwith all the necessary logic to list, edit, create and delete posts.PostStoreRequest.phpandPostUpdateRequest.php- Timestamped
create_posts_table.phpmigration file PostFactory.phppostsviews directory withindex.blade.php,create.blade.php,edit.blade.php,show.blade.php,modals/delete.blade.phpas well as a blank_form.blade.phpfor you to add the fields.
Then all you have to do is:
- Add the columns to the migration file
- Add the necessary fields (as defined in the last step) to the
_form.blade.php - Add validation rules for the fields you added to the form.
composer require jq/cray --devOr specify specific version, for example to try a beta
composer require "jq/cray:3.2.0-beta3" --devThen publish the stubs
php artisan vendor:publish --tag=crayIt will generate stubs to resources/vendor/cray/stubs directory.
php artisan cray PostOnce done, it will show you the details of the files generated.
Factory created successfully in /database/factories/PostFactory.php
Created Migration: 2020_03_14_151409_create_posts_table
Model created successfully in /app/Post.php
Controller created successfully in /app/Http/Controllers/PostController.php
View created successfully in /resources/views/posts/index.blade.php
View created successfully in /resources/views/posts/create.blade.php
View created successfully in /resources/views/posts/_form.blade.php
View created successfully in /resources/views/posts/edit.blade.php
View created successfully in /resources/views/posts/show.blade.php
View created successfully in /resources/views/posts/modals/delete.blade.php
Request created successfully in /app/Http/Requests/PostStoreRequest.php
Request created successfully in /app/Http/Requests/PostUpdateRequest.phpNow add the necessary fields and run
php artisan migrateAnd that saved you an hour worth of repetitive and boring work which you can spend on more important development challenges.
You can read the documentation here.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email junaidqadirb@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.