Download the PHP package csgt/crud without Composer
On this page you can find all versions of the php package csgt/crud. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package crud
Crud
This package is used to generate cruds.
You are on branch
master— package version8.0(tagsv8.0.x).
| Version | BS | Datatables | Methods | Views engine | Crypt | Constructor | UTC | Validation |
|---|---|---|---|---|---|---|---|---|
| 5.5 | 3 | 1.x | es | blade | yes | yes | no | formvaldiation |
| 5.6 | 4 | 1.x | es | blade | yes | yes | no | formvaldiation |
| 5.9 | 4 | 1.x | es | blade | yes | no | no | laravel |
| 6.0 | 4 | 1.x | en | blade | yes | yes | no | formvaldiation |
| 7.0 Beta | 4 | 1.x | en | vue | yes | yes | no | formvaldiation |
| 8.0 | 4/5 | 2.x | en | blade | no | no | yes | laravel |
Documentation for contributors
| Document | Read it for |
|---|---|
| docs/ARCHITECTURE.md | How the package is wired: request lifecycle, field metadata, the listing query |
| docs/METHODS.md | What every method of CrudController does on this branch |
| docs/RULES.md | What you may and may not change: no repurposing methods, behaviour changes go to a new version branch, legacy compatibility first |
Requirements
This branch (master, package version 8.0) requires:
| Requirement | Supported |
|---|---|
| PHP | >= 7.2 |
| Laravel | >= 5.8 (no upper bound declared; shipped against 8.x) |
| Frontend | Bootstrap 4/5 + jQuery + DataTables 2.x |
Compatibility matrix
The branch number is the package version, not the Laravel version. Each package version lives in its own branch and is released from it.
| Package version | Branch | PHP | Laravel | Status |
|---|---|---|---|---|
| 8.0 | master |
>= 7.2 |
>= 5.8 |
Active |
| 7.0 Beta | 7.x |
>= 7.2 |
>= 7.0 |
Active (Vue views, paginated response) |
| 6.0 | 6.0 |
>= 7.2 |
>= 5.8 |
Maintenance |
| 5.9 | 5.9 |
>= 7.1 |
>= 6.0 |
Maintenance |
| 5.8 | 5.8 |
>= 7.1 |
>= 5.8 |
Maintenance |
| 5.7 | 5.7 |
>= 7.1 |
>= 5.8 |
Maintenance |
| 5.6 | 5.6 |
>= 7.0 |
>= 5.5 |
Legacy |
| 5.5 | 5.5 |
>= 7.0 |
>= 5.5 |
Legacy |
| 5.4 | 5.4 |
>= 5.6 |
>= 5.4 |
Legacy |
| 5.3 | 5.3 |
>= 5.5 |
>= 5.1 |
Legacy |
| 5.0 | 5.0 |
>= 5.5 |
>= 5.0 |
Archived |
The Laravel floor is inferred from the framework APIs each branch actually
calls, since the composer.json constraints were never updated:
- Package auto-discovery (
extra.laravel.providers) → Laravel>= 5.5 Storage::disk()->temporaryUrl()→ Laravel>= 5.4BelongsTo::getOwnerKeyName()→ Laravel>= 5.8Relation::getRelationExistenceQuery()→ Laravel>= 5.5Paginator::withQueryString()→ Laravel>= 7.0Form::helpers (laravelcollective/html) on5.0–5.4→ Laravel5.xonly
Installation
The service provider is registered through package auto-discovery. To publish the translations:
Usage
To create a new CRUD, you may use the php artisan make:crud ExampleController command. This will set up a boilerplate
Listing performance
The data() endpoint resolves search, ordering and pagination in the
database:
- The DataTables global search becomes a
WHERE ... LIKEclause, and relation columns are matched throughwhereHas. - Ordering by a relation column uses a correlated subquery instead of sorting in memory.
- Only the requested page is fetched (
offset+limit). multifields are eager loaded, removing the N+1 query per row.
Previously the whole table was loaded into memory and filtered/sorted with
Collection methods, so the cost grew with the total number of rows instead of
the page size. No public API changed: setField, setWhere, setOrderBy and
the JSON response shape are the same.
Column filters
The listing no longer uses the DataTables global search box. Instead the view
sends a list of column/value pairs as filters[], and each one becomes a
WHERE clause:
- a plain column becomes
column LIKE ? - a relation column (
relation.column,isforeign) is matched withwhereHas - a
multifield is matched against its related column, also withwhereHas - a raw expression is matched with
whereRaw, after itsAS aliasis stripped
Rows can be added and removed in the UI, they are all applied together, and the
active set is kept in the DataTables saved state. recordsFiltered is only
recounted when at least one filter is actually applied. Filters for fields with
type => 'date' use the browser's native date picker and submit an ISO date
value (YYYY-MM-DD).
Tests
The suite covers the methods that build the listing query, asserting on the SQL
and the bindings they produce. It needs Eloquent but never a database server:
no query is executed. PHPUnit, illuminate/database and illuminate/routing
are require-dev only, so nothing changes for consumers of the package.
Upgrade from version 6 to version 8 or from 5.6 to 5.9
Add the following includes:
Rename the __construct method to:
Call the setPermissions directly
Remove all references to Crypt::encrypt and Crypt::decrypt if any methos were overriden.
Remove all references to validationRulesMessages or reglasmensaje
Remove the enclosing middleware. It is now unnecessary.