Storing attributes of a multiple models, to single array in laravel Programing Coderfunda May 19, 2022 Laravel, php No comments AnswerSorted by: Highest score (default) Date modified (newest first) Date created (oldest first) 3You can simply loop on $getJobs and collect the title names in an array like below:<?php $getJobs = JobTitle::where('department_id',DepartmentUser::where('user_id', $user->id)->first()->department_id)->get(); $titles = []; foreach($getJobs as $job){ $titles[] = $job->title; } dd($titles); Share This: Facebook Twitter Google+ Stumble Digg Email ThisBlogThis!Share to XShare to Facebook
0 comments:
Post a Comment
Thanks