How to put a field in other table?

Posted 2 months ago by irankhosravi

Look at my codes.


$requisitions = Requisition::with('schools')->where('city_id', auth()->user()->city_id)->latest()->paginate(25);


public function schools ()
    return $this->belongsTo(SchoolsList::class, 'school_id');

I have two tables schools and requisitions in my project.

schools table

id, province_id, city_id, gender,......

requisitions table

id, school_id, type, ...

How to put schools in RequisitionController

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.