PHP code example of soarecostin / laravel-toggle-switch-fields

1. Go to this page and download the library: Download soarecostin/laravel-toggle-switch-fields 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/ */

    

soarecostin / laravel-toggle-switch-fields example snippets


php artisan vendor:publish --provider=SoareCostin\LaravelToggleSwitchFields\ToggleSwitchFieldsServiceProvider
 
default_field => 'published'


use App\Http\Controllers\Controller;
use SoareCostin\LaravelToggleSwitchFields\Traits\Switchable;

class YourCustomController extends Controller
{
    use Switchable;
    // ...
}

use SoareCostin\LaravelToggleSwitchFields\Facades\ToggleSwitchFields;

ToggleSwitchFields::routes('/your-custom-url/{your-custom-route-param}', 'YourCustomController', 'your.custom.route.prefix');