Answer the question
In order to leave comments, you need to log in
Laravel. need to make a request for a selection of vacancies with periods?
DB::table('vacancies')
->leftJoin('periods', 'vacancies.id', '=', 'periods.id_vacancy')
->select('vacancies.title_u', 'periods.date_start', 'periods.date_end')
->take(1)->get();
array:1 [▼
0 => {#389 ▼
+"title_u": "Водитель"
+"date_start": 1469680740
+"date_end": 1469939940
}
]
array:1 [▼
0 => array:2 [▼
"title_u" => "Водитель"
"periods" => array:2 [▼
"date_start" => 1469680740
"date_end" => 1469939940
]
]
]
Answer the question
In order to leave comments, you need to log in
So use ORM and your colleagues will not suit you at the same time.
There will be a simple code $vacancies->with('periods')->get();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question