In almost every web application you work on, you will be asked to implement a feature that displays a list of entities, e.g. Products or Tasks, and allows Users to either add new entities, or update and delete existing entities.
Rather than write this code from scratch every time, you can copy and paste from your own battled-tested swipe file or test application.
The faster you delivery bug-free code, the better you will look to your employer or client, and the more time you'll have to work on interesting problems.
The acceptance criteria may look something like this:
- User can view a list of Tasks
- User can create a new Task
- New Tasks are added to the bottom of the list right away
- User can Update an existing Task from the list
- Updated Tasks are updated in the list right away
- User can Delete a Task from the list
- Users are asked to confirm the Delete action
- Deleted Tasks are removed from the list right away
We will be creating a list of Knights. I like Knights.
If you want to follow along with this example you can either clone this Laranerds Example Application, or you can implement these changes in your own practice Laravel application.
Ensure you checkout this tag - Manage Entities v1
After cloning the repo run
git checkout ManageEntities-1 in your terminal.
All the code required for this feature is found in the following files:
Any other files involved in the feature - models, migration, etc. - would be common to any application.
For a detailed explanation, check out the video here::
But sure to sign up at Laranerds if you want to be notified when new tutorials and code snippets are published.