Package Data | |
---|---|
Maintainer Username: | nunomazer |
Maintainer Contact: | torzer@torzer.com (torzer) |
Package Create Date: | 2017-07-04 |
Package Last Update: | 2017-07-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:07:31 |
Package Statistics | |
---|---|
Total Downloads: | 56 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel package with Blade extensions and directives for projects torzer.com.
At required
section in composer.json
file add:
"require": {
...
"torzer/laravel-blade-pack": "^1",
...
},
Then run composer update
.
In config/app.php
file, in array providers
:
'providers' => [
...
Torzer\Common\Blade\ServiceProvider::class,
...
]
A directive to remove all the csrf from the layout.
@csrf()
Access with Javascript as window.Laravel.csrfToken
.
If you need to change the namespace to something different than window.Laravel
.
@csrf('Torzer')
Would set it in
window.Torzer.csrfToken
The dd
(dump and die) function as a Blade directive.
@dd($var)
The var_dump
function as a Blade directive.
@dump($var)
The explode function as a Blade directive.
@explode(',', $string)
The implode function as a Blade directive.
@implode(',', $array)
A Blade directive to set value to a PHP variable.
@set(5, $var)
// then you can keep using the var in the same Blade view
@if($var > 10)
...
@endif
A Blade directive to set a PHP Laravel value accessible as a JS variable.
@js(token,$token)
Then you can access these data from window object in javascript
window.token