|
|
@ -37,23 +37,14 @@ class BladeExtensionsProvider extends ServiceProvider |
|
|
|
return "<?= e(app()->make('\\Faker\\Generator')->$method($params)) ?>";
|
|
|
|
return "<?= e(app()->make('\\Faker\\Generator')->$method($params)) ?>";
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// csrf token for forms |
|
|
|
|
|
|
|
Blade::directive('formCsrf', function () { |
|
|
|
|
|
|
|
return '<?= csrf_field() ?>';
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// json encode |
|
|
|
// json encode |
|
|
|
Blade::directive('json', function ($x) { |
|
|
|
Blade::directive('json', function ($x) { |
|
|
|
return "<?= json_encode(($x), JSON_UNESCAPED_SLASHES) ?>";
|
|
|
|
return "<?= toJSON($x) ?>";
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// json encode, escaped |
|
|
|
// json encode, escaped |
|
|
|
Blade::directive('jsone', function ($x) { |
|
|
|
Blade::directive('jsone', function ($x) { |
|
|
|
if (config('app.pretty_json')) { |
|
|
|
return "<?= e(toJSON($x)) ?>";
|
|
|
|
return "<?= e(json_encode(($x), JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) ?>";
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return "<?= e(json_encode(($x), JSON_UNESCAPED_SLASHES)) ?>";
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// selected if cond true |
|
|
|
// selected if cond true |
|
|
@ -66,10 +57,6 @@ class BladeExtensionsProvider extends ServiceProvider |
|
|
|
return "<?= ($x) ? 'checked' : '' ?>";
|
|
|
|
return "<?= ($x) ? 'checked' : '' ?>";
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Blade::if('admin', function () { |
|
|
|
|
|
|
|
return \Auth::user()->isAdmin(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Blade::if('set', function ($x) { |
|
|
|
Blade::if('set', function ($x) { |
|
|
|
return config($x) != ''; |
|
|
|
return config($x) != ''; |
|
|
|
}); |
|
|
|
}); |
|
|
|