I’m building a Laravel application that involves tracking different types of leads. For example, there are Refinance leads and Purchase leads.
Since the leads share a lot of information and functionality, but not all, my thinking was to create a Lead
class, which extends Laravel’s Model
class, and then a RefinanceLead
class, which extends the Lead
class.
So I’d have:
class Lead extends Model
{
// shared lead stuff
}
class RefinanceLead extends Lead
{
// stuff specific to refinance leads
}
My questions are:
- Does this strategy make sense?
- If it does, how is Eloquent going to handle the data? Will I have a
leads
table and arefinance_leads
table? - Will a new instance of the RefinanceLead class utilize anything in the
leads
table?
I’ve had trouble answering this question via the documentation, but if I missed where this is explained, please let me know. Thanks.