Created
May 11, 2016 18:16
-
-
Save matthijs110/4e33c07ed49d5831d04d94b5eaf7d160 to your computer and use it in GitHub Desktop.
This file contains 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\Providers; | |
use Blade; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Perform post-registration booting of services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// Use @humantime($expression) to output a Carbon time object as human readable time. | |
Blade::directive('humantime', function($expression) { | |
return "<?php echo with{$expression}->diffForHumans(); ?>"; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment