Displaying data in Blade template



in my controller, I pass my template a list of projects

$projects = Project::all();
return view('projects.index', compact('projects'));

Now a Project has one client, and a client belongs to a project. If I loop my Projects within my view, I get the following data

#attributes: array:11 [▼
    "id" => "25"
    "jobNumber" => "J0001"
    "projectName" => "Some Name"
    "clientId" => "1"
    "clientContact" => "Some Contact"
    "contactEmail" => "email@email.co.uk"
    "status" => "Email"
    "deleted_at" => null
    "created_at" => "2016-04-25 14:15:19"
    "updated_at" => "2016-04-26 10:05:06"
]

As you can see, the clientId is 1. This links to a particular client. Is there any way to get the client name using this ID? I know how to do it in the controller, but I can't pass a variable for each project which has the clients name, this would be too much. As it stands, I am passing the view all of the projects, and each of these has a clientId. Somehow I need to get the named based off this.

Thanks


Related to : Displaying data in Blade template

HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .