Download the PHP package prolaxu/fast-api-crud without Composer
On this page you can find all versions of the php package prolaxu/fast-api-crud. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download prolaxu/fast-api-crud
More information about prolaxu/fast-api-crud
Files in prolaxu/fast-api-crud
Package fast-api-crud
Short Description Laravel API CRUD with extended controller
License MIT
Informations about the package fast-api-crud
About FastApiCrud
It provides basic to advanced CRUD (Create, Read, Update, Delete) functionality for a given model.
Composer
Installation
Child Constructor method
- $model: The name of the model that this controller is responsible for.
- $storeRequest: The name of the request class to use when storing data.
- $updateRequest: The name of the request class to use when updating data.
- $resource: The name of the resource class to use when returning data.
This package has auto-discovery for laravel 6 and higher and for below you can add this in your providers array
This package is build on Top of Spatie role and permission Register in Kernel.php if you want to apply permission as well
Eample
The class has several protected properties that can be overridden in child classes:
- : An array of scopes to apply when fetching all records.
- : An array of scoped values to apply when fetching all records.
- : An array of scopes to apply when fetching a record.
- : An array of scoped values to apply when fetching a record.
- : An array of relationships to eager load when fetching all records.
- : An array of relationships to count when fetching all records.
- : An array of aggregate functions to apply when fetching all records.
- : An array of relationships to eager load when fetching a single record.
- : An array of relationships to count when fetching a single record.
- : An array of aggregate functions to apply when fetching a single record.
- : A boolean indicating whether the controller is being used as an API or not.
- : A boolean indicating whether to perform a soft delete or a hard delete.
- : A boolean indicating whether to apply permission or not.
- : An array of scopes to apply when deleting a record.
- : An array of scoped values to apply when deleting a record.
- : An array of scopes to apply when changing status of a record.
- : An array of scoped values to apply when changing status of a record.
- : An array of scopes to apply when restoring a record.
- : An array of scoped values to apply when restoring a record.
- : An array of scopes to apply when updating a record.
- : An array of scoped values to apply when updating a record.
The class has several methods that correspond to basic CRUD operations:
-
- Return Collection of all records.
-
- Create a new record.
-
- Return a single record.
- Delete a record.
-
- Bulk delete records.
-
- Change specific value between 0 and 1 provided from child class
-
- Update a record.
-
- Change status column value of a record between 0 and 1.
-
- Restore a soft deleted record.
-
- Restore all soft deleted records.
-
- Hard delete a soft deleted record.
There are also two helper methods, and , that return a JSON response with a message and data. These are used to standardize error and success responses across the controller.
for example
This package has also featured for making service ,action,trait file also
After installation, the command php artisan make:service {name} {--N|noContract}
will be available.
Create services files
For example, the command php artisan make:service createUser
will generate a service file called CreateUserService.php
located in app/Services/CreateUser
.
It will also generate an interface (contract) called CreateUserContract.php
located in app/Services/Contracts
.
Create services for models
Adding a or option is now available when creating a model.
For example, the command php artisan make:model Post --service
or php artisan make:model Post -S
will generate a model with service too.
The command php artisan make:model Post --all
or php artisan make:model Post -a
will now generate a model, migration, factory, seeder, policy, controller, form requests and service.
Contracts
Adding a or option will prevent the commands from implementing any contract and will not create any contract file.
If you never need any contracts. Publish the config file and then turn the with_interface value to false in the config file.
All versions of fast-api-crud with dependencies
illuminate/http Version 10.*|9.*|8.*|7.*|6.*|5.*
illuminate/pagination Version 10.*|9.*|8.*|7.*|6.*|5.*|4.*
illuminate/routing Version 10.*|9.*|8.*|7.*|6.*|5.*
illuminate/support Version 10.*|9.*|8.*|7.*|6.*|5.*
spatie/laravel-permission Version 6.x-dev|5.*|4.*|3.*|2.*|1.*