Download the PHP package mmstfkc/basic-crud without Composer
On this page you can find all versions of the php package mmstfkc/basic-crud. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mmstfkc/basic-crud
More information about mmstfkc/basic-crud
Files in mmstfkc/basic-crud
Package basic-crud
Short Description This structure is designed for use in basic CRUD operations.
License MIT
Informations about the package basic-crud
You should run the following command for installation of the project.
Copy Config File
(Optional) If you want the error messages to be displayed as in the package, you can follow the steps below.
Go to the file below and add the commands.
app/Exceptions/Handler.php:56
Usage of the Package
After completing the package installation, the necessary steps to follow are as follows:
Controller
We create a controller and extend ModelController class to these controllers.
:warning: ModelController is extended from "App\Http\Controllers\Controller" located in your own directory. Any changes you make there will affect the package. :warning:
Example of your Controller file can be as follows.
Route
To be able to make requests to these endpoints, you can add the following command to your route/api.php file.
Example api.php file can be as follows:
To write your own functions, you can use the following example usage:
You can define your own functions inside your controller class that extends the ModelController.
After defining your function, you can access it using the appropriate HTTP method and route in your routes/api.php file.
Filter
http://localhost/api/users?where[0][id]=1
Here, "where" is a filtering parameter used to filter users. The part "where[0][id]=1" specifies the filtering condition. So, this request is used to retrieve users with the "id" property equal to 1.
Here are some examples of the filtering parameters:
- whereIn: Retrieves users with a specific property matching one or more specified values.
For example: http://localhost/api/users?whereIn[0][status]=active,verified This request retrieves users with the "status" property equal to either "active" or "verified". - whereNotIn: Retrieves users with a specific property not matching any of the specified values.
For example: http://localhost/api/users?whereNotIn[0][role]=admin,superuser This request retrieves users with the "role" property not equal to "admin" or "superuser". - whereDate: Retrieves users born on a specific date or having a specific date property.
For example: http://localhost/api/users?whereDate[0][birthdate]=2023-01-01 This request retrieves users with the " birthdate" property equal to 2023-01-01. - whereTime: Retrieves users born at a specific time or within a specific time range.
For example: http://localhost/api/users?whereTime[0][created_at]=15:00:00 This request retrieves users with the " created_at" property equal to 15:00:00. - like: Retrieves users with a specific property containing a specific text.
For example: http://localhost/api/users?like[0][name]=John This request retrieves users with the "name" property containing the text "John". - ilike: Retrieves users with a specific property containing a specific text case-insensitively.
For example: http://localhost/api/users?ilike[0][email]=john This request retrieves users with the "email" property containing the text "john" regardless of case.
By using these filtering parameters, you can make your requests more readable and filter users based on specific criteria.
This project is licensed under the MIT License. See the LICENSE.md file for details.