last day (14 days later) » 

1:50 PM
0
Q: A better way to improve blade template?

I'll-Be-BackThere are two type of packages that a customer can choose from: Phone packages or Broadband & Phone Packages. When user ready to place an order, it will show a summary view with package name information and the cost. Some Summary information does not need to show if they select Phone package or ...

 
Is $summary an Eloquent model?
 
@lukasgeiter No. $summary has been declared in OrderController.php file via generateSummary() method. generateSummary() calculate the costs, total price, etc via sessions and database.
@lukasgeiter can you advice me what to improve on blade
 
Can you post the full code to a site like pastebin so I can see what's going on here?
Thanks, but I actually meant the full view code ;)
 
@lukasgeiter updated, scroll down to see view code gist.github.com/striketest/e0025a58c3977e7a9ac2 (I haven't finish view code yet but I will be adding a lot of if ($summary['service'] == "phone") and if ($summary['service'] == "broadbandphone")
 
I still don't see "a lot of if statement broadbandphone or phone". And by the way, this question might be better off on codereview
 
1:50 PM
Oh ok. How would you do differently?
 
The code I have seen from you doesn't look too bad. I would leave it like it is now
 
Cool :)
 
Just make sure to indent your code correctly so it's clear where one if starts and where it ends :)
 
Later I will be adding more of `@if ($summary['service'] == "broadbandphone")
...
@end`
 
ok. I'll add a little answer with some general advice...
 
1:57 PM
Thanks
It will be extended bunch of: `@if ($summary['service'] == "phone" || $summary['service'] == "broadbandphone")

<h4>Something x <span class="summary-lines">{{$summary['lines']}}</span></h4>

@if ($summary['service'] == "phone")
....

@end if

<div> Something Something {{$summary['name']}}</div>
@if ($summary['service'] == "broadbandphone")
....
@endif
@if ($summary['service'] == "phone")
....
@endif
@end`
with approx of 200 lines lol
 
Alright. I wrote an answer with some tips. Hope it helps ;)
 
Thanks man!
 

last day (14 days later) »