PHP code example of tripteki / laravelphp-setting-locale

1. Go to this page and download the library: Download tripteki/laravelphp-setting-locale 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/ */

    

tripteki / laravelphp-setting-locale example snippets


use Tripteki\SettingLocale\Contracts\Repository\Admin\ISettingLocaleLanguageRepository;
use Tripteki\SettingLocale\Contracts\Repository\Admin\ISettingLocaleTranslationRepository;
use Tripteki\SettingLocale\Contracts\Repository\ISettingLocaleRepository;

$languageRepository = app(ISettingLocaleLanguageRepository::class);
$translationRepository = app(ISettingLocaleTranslationRepository::class);

// $languageRepository->create([ "code" => "en", "locale" => "en-US", ]); //
// $languageRepository->delete("en"); //
// $languageRepository->update("en", [ "locale" => "en-UK", ]); //
// $languageRepository->get("en"); //
// $languageRepository->all(); //

// $translationRepository->create("en", [ "key" => "auth.throttle", "translate" => "Too many login attempts. Please try again in :seconds seconds.", ]); //
// $translationRepository->delete("en", "auth.throttle"); //
// $translationRepository->update("en", "auth.throttle", [ "key" => "auth.throttle", "translate" => "Too many login attempts. Please try again in :minutes minutes.", ]); //
// $translationRepository->get("en", "auth.throttle"); //
// $translationRepository->all("en"); //

$repository = app(ISettingLocaleRepository::class);
// $repository->setUser(...); //
// $repository->getUser(); //

// $repository->setLocale("en"); //
// $repository->getLocale(); //
// locale(); //
// $repository->translate("auth.throttle"); //
// trans("auth.throttle"); //
// __("auth.throttle"); //

php artisan vendor:publish --tag=tripteki-laravelphp-setting-locale-migrations

php artisan migrate

php artisan vendor:publish --tag=tripteki-laravelphp-setting-locale-tests