In general, there is a request:
DB::table('vacancies') ->leftJoin('periods', 'vacancies.id', '=', 'periods.id_vacancy') ->select('vacancies.title_u', 'periods.date_start', 'periods.date_end') ->take(1)->get(); Result:
array:1 [▼ 0 => {#389 ▼ +"title_u": "Водитель" +"date_start": 1469680740 +"date_end": 1469939940 } ] We need to make a request, so that the vacancies have several periods in the array (which is lower), How can this be done?
array:1 [▼ 0 => array:2 [▼ "title_u" => "Водитель" "periods" => array:2 [▼ "date_start" => 1469680740 "date_end" => 1469939940 ] ] ]