, (*1)
LaravelDbTrans
LaravelDbTrans is a package for automatic creating and edition translates in database., (*2)
Template:
{{ __('Some words') }}
or using prefix:
{{ __('myprefix.Some words') }}
In both cases, records will be created in the database, and returned to the tempate only "Some words"
Installation
-
Require this package in your composer.json and run composer update :, (*3)
"goszowski/laravel-db-trans": "1.*"
-
After composer update, add service providers to the config/app.php, (*4)
Goszowski\LaravelDbTrans\LaravelDbTransServiceProvider::class,, (*5)
-
Run, (*6)
php artisan vendor:publish, (*7)
-
Migrate, (*8)
php artisan migrate, (*9)
Configuration
Visit url /laravel-db-trans in your app. Here will be all translations that will be created., (*10)
If You want to protect this url or change name, You must disable option use_package_routes in config/laraveldbtrans.php, (*11)
After this, You must create routes for you app by this template:, (*12)
Route::group(['prefix'=>'laravel-db-trans', 'as'=>'laravel-db-trans.'], function(){
Route::get('/', ['as'=>'index', 'uses'=>'\Goszowski\LaravelDbTrans\LaravelDbTransController@index']);
Route::get('/{key}', ['as'=>'edit', 'uses'=>'\Goszowski\LaravelDbTrans\LaravelDbTransController@edit']);
Route::patch('/{key}', ['as'=>'update', 'uses'=>'\Goszowski\LaravelDbTrans\LaravelDbTransController@update']);
Route::delete('/{key}', ['as'=>'destroy', 'uses'=>'\Goszowski\LaravelDbTrans\LaravelDbTransController@destroy']);
});
Also, You can customize blade templates in views/vendor/laravel-db-trans, (*13)