PHP code example of rhincodon / laravel-db-language

1. Go to this page and download the library: Download rhincodon/laravel-db-language 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/ */

    

rhincodon / laravel-db-language example snippets


Rhinodontypicus\DBLanguage\DbLanguageServiceProvider::class,

$language = \Rhinodontypicus\DBLanguage\Language::create(['name' => 'English']); // Create language

// Somewhere in your middleware you can load all constants
db_language()->load($language->id); // Load all constants for language
db_language()->load($language->id, 'site'); // Load all constants for language from 'site' group

// Somewhere in view/controller, group::value syntax
db_language('site::some_constant'); // Get language constant for loaded language
db_language('site::some_constant', 'Default Value'); // Get language constant with default value. If constant does not exists, value will be created in database for the first time

db_language()->language(); // Get current loaded language
db_language()->language('name'); // Current loaded language field
bash
php artisan vendor:publish
php artisan migrate