Last active
September 28, 2015 18:38
-
-
Save segovia94/b1fe94c975d40faa5197 to your computer and use it in GitHub Desktop.
Custom Laravel Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // resources/views/partials/_header-images.blade.php ?> | |
<div class="header-images"> | |
@foreach($images as $image) | |
<div>{!! Html::image($image) !!}</div> | |
@endforeach | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"autoload": { | |
"classmap": [ | |
"database" | |
], | |
"psr-4": { | |
"App\\": "app/" | |
}, | |
// Add this to the file | |
"files": [ | |
"app/helpers.php" | |
] | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App; | |
// app/helpers.php | |
use File; | |
class Helpers { | |
/** | |
* Rotating Header Images | |
* | |
* @param string $file_path | |
* @return array|bool | |
*/ | |
static function header_images($file_path = 'images/header') { | |
// Generate Header Images | |
return $header_images; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // resources/views/template.blade.php ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Custom Laravel Helper</title> | |
</head> | |
<body> | |
<header class="header"> | |
@include('partials._header-images', array($images = \App\Helpers::header_images())) | |
</header> | |
<div class="content"> | |
@yield('content') | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment