Support the ongoing development of Laravel.io →
posted 10 years ago
Architecture
Last updated 2 years ago.
0

Hey, wow :) I am also studying best practices at the moment and this example of yours is very easy to understand! Thanks! Keep it KISS like it is at the moment :).

Last updated 2 years ago.
0

What I wanted to add more is testing and custom validation. If you find anything useful send me a pull request.

Last updated 2 years ago.
0

Yeah, those would be handy as well :). Maybe add some sort of "levels" (branches) where with every level you increase the number of patters/technics used.

edit: Do I need to create a different validation service when I need to have (slightly) different validation rules when updating a model for example?

Last updated 2 years ago.
0

Maybe some points you could add or at least some inspiration:

Entities http://culttt.com/2014/01/27/creating-entities-laravel-4/

Model Presenters (there are two good packages) http://culttt.com/2014/03/03/model-presenters-laravel-4/

and Caching as a Service: http://culttt.com/2014/02/03/laravel-4-cache-service/

Last updated 2 years ago.
0

Added custom validation rules through a service provider. Took me 3 days to figure out why it was not working !!

Also, I have restructured the respositories into separate folders.

Ilyes512 said:

Yeah, those would be handy as well :). Maybe add some sort of "levels" (branches) where with every level you increase the number of patters/technics used.

Will see :)

edit: Do I need to create a different validation service when I need to have (slightly) different validation rules when updating a model for example?

You need to add a validator at app/lib/Sampleapp/Services/Validators/YourShinyNewValidator.php, and in your gateway app/lib/Sampleapp/Gateways/SomeGateway.php use

$myValidator = new \Sampleapp\Services\Validators\YourShinyNewValidator($input);

Thats the way it is structured for now.

I think there was a bug in the original code ($input) was not passed to the YourShinyNewValidator. Please check the updated code.

Last updated 2 years ago.
0

psychonetic said:

Maybe some points you could add or at least some inspiration:

Entities http://culttt.com/2014/01/27/creating-entities-laravel-4/

Model Presenters (there are two good packages) http://culttt.com/2014/03/03/model-presenters-laravel-4/

and Caching as a Service: http://culttt.com/2014/02/03/laravel-4-cache-service/

Will check that next :) Thanks.

Last updated 2 years ago.
0

I have added reference links in the top of every file, if you need to know the theory behind it then check that link.

Last updated 2 years ago.
0

Added https://github.com/robclancy/presenter presenter to the 'robclancy-presenter' branch.

https://github.com/octabrain/Laravel4-Patterns/tree/robclancy-presenter

I was not able to get the "Extending the Decorator" working :(

I will try https://github.com/ShawnMcCool/laravel-auto-presenter next.

Last updated 2 years ago.
0

Just an update.

Integrated presenter https://github.com/ShawnMcCool/laravel-auto-presenter and also updated the readme

https://github.com/octabrain/Laravel4-Patterns/

:)

Edit : Full version is now available at

https://github.com/octabrain/Laravel4-Patterns-Full

I hope this helps :)

Last updated 2 years ago.
0

I see you also now inject the validator. Although I think it needs to be injected, I don't think that injecting it in the __construct is any helpful, cause you probably want other validator rules for updating a record.

Method injection is going to be so awesome for this (see this Laracast video, it's a Laravel 5 feature).

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

octabrain octabrain Joined 8 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.