Kutipan Blade Laravel dari Tubuh
<?php
// php artisan make:provider BladeServiceProvider
// import into config/app.php -> providers[]
use Illuminate\Support\Facades\Blade;
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
Blade::directive('excerpt', function ($text) {
return "<?php echo Str::limit($text, 100); ?>";
});
}
// in view: <p>@excerpt($post->body)</p>
DJ Ultimate Disco Party