Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Łukasz Czuliński
8,646 PointsLaravel: where to put UI logic?
For example, in a view I have:
<td class="table-reference">
<?php echo substr($biblio['reference'], 0, strpos($biblio['reference'], '(')); ?>
</td>
I wanted to write a function for the string parsing to make it cleaner. Where does that usually go? It seems out of place in both controller or model.
1 Answer
Ron McCranie
7,837 PointsYou should consider creating a 'helper'
Here's a link to a good post on how to do that: http://laravel-recipes.com/recipes/50/creating-a-helpers-file
Łukasz Czuliński
8,646 PointsŁukasz Czuliński
8,646 PointsThanks, that looks promising. View Composer looks to work too.