Displaying data in Blade template


Edwin Goei
26/4/2016 6:52 am
HOME » Web Development

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
Displaying data in Blade template
26/4/2016 6:52 am by Edwin Goei in Web Development

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 dat


Right way to pass input data to blade template in Laravel?
17/12/2014 5:10 pm by Excessi0n in Web Development

Is there any difference when i am passing POST data to blade template, between this :

Route::post('postpage', function()
{
    return View::make('postdata')->with('postData', Input::all());
});

and this one?

Route::post('postpage', function()

How to Include @ symbol in blade template page without it being processed as blade code in Laravel
by Allan in Web Development

So my dilemna is this.<p>Email: info@example.com</p>Is being processed as blade code and won't re-size in my responsive bootstrap web page in my Laravel 4 framework.Any ideas on how to get blade to ignore the @ symbol? It is probably a simple fix I just can't find it on the web. Thanks
How to see post back data on any view page in laravel which uses blade template system?
by evident in Web Development

How can I print post back data on any view page in Laravel framework which uses blade template system.$_POST['state'] is not giving any results.
Displaying 2-dimensional data array in django template
by Robert M in Web Development

I have a bunch of woods and a bunch of properties, describing the wood. The property of a specific wood is given by Answer (basically answers = woods x properties):class Wood(models.Model): desc = models.CharField(max_length=63)class Property(models.Model): desc = models.CharField(max_length=6
Displaying properties of a class in hierarchical data template
by bps in Web Development

I have a class Case.It has properties DependencyCaseName,GroupName,CaseName. I want to represent the properties in the following structure in a treeview.
The ItemSource to the treeview is ObservableCollection<Case>.
Expand|Select|Wrap|Line Numbers Group1    |_
Emberjs Displaying Associative Data Within Parent Model Template
by skimple in Web Development

I've hit a snag in my Ember application that I've been trying to break free from. I have a two models like below:App.UserModel = DS.Model.extend({ ../ actions: DS.hasMany('action')});andApp.ActionModel = DS.Model.extend({ ../ user: DS.belongsTo('user')});My route for viewing a user profile is as
Inheritance template using Blade
2/12/2014 10:30 am by cmt95 in Web Development

I have a problem with my inheritance using blade template. So I have my main template: /layouts/main.blade.php

@section('oneNews')
<div class="row">
  <div class="large-12 columns pad_0">
      <div class="container">
          <div id="da-slider" class="da-s
Laravel's Blade: how can I set variables in a template?
by Brent Robinett in Web Development

I'm reading Laravel Blade's templating docs and I can't find how I can assign variables inside a template for use later in the template. I can't do {{ $old_section = "whatever" }} because that will echo "whatever" and I don't want that.


I see that I can do <?php


Is there any other stand alone template engine like blade in php?
18/1/2015 6:10 pm by EvilNodZ in Web Development

I really like the blade syntax, because it compiles the {{}} into php's <?php echo ...; ?>, but I have no find another to use with another project that is not laravel. I know that there is Twig, Mustache but it doesnt compile to php it just compiles to a view. Do y


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 .