I am writing something to generate HTML from stuff in a DB. I have rows and panels.
I get all the rows via a Row model and the panels linked to the row via:
return $this->hasMany('App\Panel');
So i have the rows with a collection of the panels by calling in my controller:
row = App\Row::where('id', $id)->with('panels')->first();
return view('front.editrow',['row'=>$row]);
All that is fine.
What I would like to do is generate a style based upon parameters in the DB, something like and send that also with the $row info:
$style = "background-color:".$row->backgroundcolor.";";
if ($row->backgroundimage <> '')
{$style = $style."background-image:url(".$row->backgroundimage.");";}
$style = $style."padding-top:". $row->padding_top.";";
Is this possible?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire