Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

"solved" laravel eloquent model on table with condition

I want to ask if is possible with eloquent making model with condition on column. for example, i want to make table users with column role enum('teacher','student') how to make models for student and teacher? thanks.

question from:https://stackoverflow.com/questions/65830488/solved-laravel-eloquent-model-on-table-with-condition

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

use single Table Inheritance (STI) or Sub-classing through this package caleb porzio parental


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...