If you need to customize a repository, you can inherit from the base repository, which provides all the data interfaces required by resource
. If the requested method is not implemented, an exception will be thrown.
You can view the base repository source code for more information.
Method | Description |
---|---|
paginate(qs, filters) | Pagination data |
export(qs, filters) | Export data |
options(qs, filters) | Option data |
edit(id) | Edit data |
show(id) | Detail data |
store(data) | Create data |
update(id,data) | Update data |
delete(id) | Delete data |
restore(id) | Restore deleted data |
forceDelete(id) | Force delete data |
If your repository needs to handle CRUD operations for resources, you can inherit from the resource repository, which includes all the methods of the base repository. It also additionally implements the interfaces required for crud
.
You can view the resource repository source code for more information.
Method | Description |
---|---|
only() | Get secure input data |
scope() | Global query scope control |
getModel() | Get model |
setModel() | Set model |
getOptionsValue() | Get option data ID for saving |
getRelationValues() | Get relation data ID for saving |
queryBuilder(query,params,filters) | Build query |
Name | Default Value | Description |
---|---|---|
pk | id | Primary key name |
fields | None | Allowed operation fields |
model | None | Repository model |
filters | { id: eq, orderBy: orderBy} | Allowed filter fields |
If your repository needs to request external data, you can use axios
or fetch
to build request configurations.
Using axios to request data