Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

etelford's avatar

4.3 BaseModel

What's the recommended way to create some sort of base model in 4.3?

0 likes
5 replies
JeffreyWay's avatar

Create a BaseModel class, and have all your Eloquent models extend it.

etelford's avatar

I'm sorry. That was stupid of me. I meant a Base Controller since setupLayout() doesn't exist anymore.

Should we use some sort of service provider instead?

JeffreyWay's avatar
Level 59

What specifically are you trying to accomplish?

If you just want an abstract class that your controllers can inherit from, then just create a BaseController class that extends Controller. Same process.

etelford's avatar

Specifically a before filter for all but a couple of my routes, but I wanted to handle it outside of routes.php. Maybe that's the best place for it though?

Please or to participate in this conversation.