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

Any answer ?

Thanks

Last updated 2 years ago.
0

BaseController seems a good place. I would also suggest looking for design patterns, creating basic APIs or traits if you use PHP 5.4.

Last updated 2 years ago.
0

May I ask why this need's to be in every controller? If you had like

protected $table = 'blablabla';

it would make sense (but would be misplaced) but since you post the type anyway, wouldn't it just be simpler to have 1 url/method for that instead?

Last updated 2 years ago.
0

This doesn't seem very safe. Your injecting that variable straight in the query, instead of binding parameters. You can create a BaseController with this function, use Trait with this method or use Eloquent Models and add a trait there, and just call that method in all your controllers.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

bidibule bidibule Joined 4 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.