Craigs Portfolio

3. CRUD & Rules

CRUD

After migrating to the database I can now build the CRUD on each of these automatically using backpack commands as shown below.

For each Model the command adds a route, nav-item into the sidebar, traits, request files for validation/rules and a crud controller.

The nav-item sidebar is purely html code from Bootstrap which is using line-icons.

The route links to the controller which extends CrudController and uses traits for the CRUD opertation. Each part of CRUD (Create, Read, Update & Delete) has its own traits setup within the controller.

The first screenshot is the CRUD traits and the routes. The second is the setup operation for the Create. All of the CRUD traits have a setup operation apart from Delete which just deletes the data. The Update is set as $this->setupCreateOperation(); which just uses the same operation as create. I tried a few different setup methods but this seems to work perfectly fine.

Rules

Currently the not null fields when are left null show the error below which is messy, to counter this I need to setup Validation Rules.

When I setup rules it checks these before submitting the data and if does not match the rule then it errors. Below I setup rules for the category and left the slug as blank as I did above which now shows this error instead.

This looks a lot better than the above database error just by adding a few rules.

Server Side Systems

5. Conclusion

Conclusion Overall I had a lot of issues and I made a lot of major stupid mistakes in this project. I couldn’t get started due

Read More »
Server Side Systems

4. UI Techniques

Reorder Lists I originally tried setting up the reorder lists by using the database. I was using lft, rgt and depth which was used in

Read More »
Server Side Systems

2. Extensions

Extensions I had a look at quite a few of the different extensions available for Laravel. I am not 100% sure that extensions is the

Read More »