PHP code example of mannysoft / ziggy

1. Go to this page and download the library: Download mannysoft/ziggy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mannysoft / ziggy example snippets



return [
    // 'whitelist' => ['home', 'api.*'],
    'blacklist' => ['debugbar.*', 'horizon.*', 'admin.*'],
];

Route::whitelist(function () {
    Route::get('...')->name('posts');
});

Route::whitelist()->get('...')->name('posts');

Route::blacklist(function () {
    Route::get('...')->name('posts');
});

Route::blacklist()->get('...')->name('posts');


return [
    'groups' => [
        'admin' => [
            'admin.*',
            'posts.*',
        ],
        'author' => [
            'posts.*',
        ]
    ],
];

@routes('author')

// routes/web.php



Route::get('/', function () {
    return view('welcome');
})->name('home');

Route::get('/login', function () {
    return view('login');
})->name('login');

// config/ziggy.php



return [
    'skip-route-function' => true
];

$customDirectives = $this->app['blade.compiler']->getCustomDirectives();
foreach ($customDirectives as $name => $closure) {
  $this->app['Bkwld\LaravelHaml\HamlBladeCompiler']->directive($name, $closure);
}
js
route('events.venues.show', {event: 1, venue: 2, page: 5, count: 10}) // Returns '/events/1/venues/2?page=5&count=10'
js
Ziggy.defaultParameters = {
    //example
    locale: "en"
}

php artisan ziggy:generate "resources/foo.js"