This project is a simple Laravel CRUD built using Laravel API Resources.
Installation
Follow these steps to set up the project locally:
-
Clone the repository:
git clone https://github.com/LaravelDaily/CRUDs-Laravel-Blade.git projectcd project -
Install dependencies:
composer installnpm install && npm run build -
Copy the
.envfile and configure your environment variables:cp .env.example .env -
Generate the application key:
php artisan key:generate -
Set up the database:
- Update
.envwith your database credentials. - Run migrations and seed the database, repo includes fake tasks:
php artisan migrate --seed
- Update
-
If you use Laravel Herd/Valet, access the application by calling
http://project.test/api/tasksin your API client.
Features to Pay Attention To
These are the main features of this API project.
- Return Types in the Controller: ex.
public function destroy(Task $task): JsonResponse - Utilizes Form Request classes for validation, with
$request->validated()then used in the Controller - Includes Factory and Seeder for the
TaskModel - Uses Eloquent API Resources to return only specific fields and wrap data with the default
datawrapper - Includes Pest test file
TasksCRUDTestthat has methods to test all Controller endpoints and also validation of each field. - Includes documentation generated by Scribe package, you can access it at
/docs/index.htmlin your browser

