vendredi 18 décembre 2015

Cache Reusability and DRY code in Laravel 5.1

I have the following lines of code that are being repeated, not only in many methods of a Controller but also in more than one Controller.

$Categories = \Cache::rememberForever('Categories', function() {
    return \App\Models\Skill\Category_Model::all();
});

Is there any useful way that I can use this, such that the repeated code can be removed?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire