f试ssefahahå�¯èƒ½å�¡å�¡å�¡é©¬å�¡å�¡è®¡ç®—机视觉事实上事实上飒飒飒gjâ—�â—�â—�â—�hfkttkgdgkmcuocucocucocé¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶uco朵朵å�¯å�¯æ”¾2å·�峨2555555666369🌹 �����ѩ�����һ����dddf2qevf2fv69666 ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK JCW](‡Q5 5 LICENSEnu „[µü¤ MIT License Copyright (c) 2023 Mahmud Elseyyidömer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK JCW]^3‹ŸÊ Ê README.mdnu „[µü¤ # Laravel Json Localization Manager This is a package to manage json strings for Laravel 5.4 and higher Localization Translation Strings As Keys With MySQL. [Using Translation Strings As Keys][6ea2d96e] [6ea2d96e]: https://laravel.com/docs/5.4/localization#using-translation-strings-as-keys "Using Translation Strings As Keys" ## Composer require ``` bash $ composer require elseyyid/laravel-json-mysql-locations-manager ``` ## Add Provider into config/app.php ``` php Elseyyid\LaravelJsonLocationsManager\Providers\LaravelJsonLocationsManagerServiceProvider::class, ``` ### For Only local environment Add the following to the AppServiceProvider in the register function: #### app/Providers/AppServiceProvider.php ``` php if ($this->app->environment() == 'local' || $this->app->environment() == 'testing') { /* * Load third party local providers */ $this->app->register(\Elseyyid\LaravelJsonLocationsManager\Providers\LaravelJsonLocationsManagerServiceProvider::class); } ``` ## Package install Run in console this command ``` bash $ php artisan elseyyid:location:install ``` This command install database and will ask if you want to import the existing locations in the application. There are 2 questions, the first to import the strings in arrays and the second to import the existing strings into json files. This will pupulate the database with all strings. You don't need to run artisan migrate, this package uses an independent database (sqlite). ### Other Console Command You can publish all languages Json files in console running ``` bash $ php artisan elseyyid:location:publish ``` Of course you also can do that in browser views. ## Manage Locations Now you can access to /translations/home in your browser and manage all langs strings. - Search Language Strings - Add new Language - Add new Strings - Edit Strings - Publish / Update json Files ## Publish the views and config file ``` bash $ php artisan vendor:publish --provider='Elseyyid\LaravelJsonLocationsManager\Providers\LaravelJsonLocationsManagerServiceProvider' ``` ### In the config file you can call your custom layout, the content section and the scripts section (this is important for the edit views) and routes prefix and middlewares. ## Routes middlewares in config file you can add your middlewares, by default is only 'web' middleware ### Feel free to send improvements Created by [elseyyid][760a7857] [760a7857]: https://github.com/OmarElseyyid "https://github.com/OmarElseyyid" PK JCW]z¹£% % " src/Controllers/HomeController.phpnu „[µü¤ files = $filesystem; } public function index() { if (Schema::hasTable('strings')) { $fields = \DB::getSchemaBuilder()->getColumnListing('strings'); } else { Artisan::call('elseyyid:location:install'); $fields = \DB::getSchemaBuilder()->getColumnListing('strings'); } $exceptions = ['en','code','created_at','updated_at']; $filtered = collect($fields)->filter(function ($value, $key) use($exceptions){ if (!in_array($value,$exceptions) ) { return $value; } }); return view('langs::home')->with('langs', $filtered); } public function lang($lang) { $list = Strings::select(['code','en',$lang])->get(); return view('langs::list')->with('lang', $lang)->with('list', $list); } public function update(Request $request,$code) { $column_name = $request->get('name'); $column_value = $request->get('value'); if($request->has('name') && $request->has('value')) { $test = Strings::select() ->where('code', '=', $code) ->update([$column_name => $column_value]); return response()->json([ 'code'=>200], 200); } return response()->json([ 'error'=> 400, 'message'=> 'Not enought params' ], 400); } public function generateJson($lang) { $list = Strings::pluck($lang,'en'); $json = json_encode_prettify($list); $this->files->put(base_path('lang/'.$lang.'.json'),$json); return redirect()->back()->with(config('elseyyid-location.message_success_variable'), 'Publicado'); } public function newLang(NewLangFormRequest $request) { $fields = \DB::getSchemaBuilder()->getColumnListing('strings'); if (! in_array( $request->newLang, $fields )) { Schema::table('strings', function (Blueprint $table) use($request){ $table->text($request->newLang)->nullable(); }); } return redirect()->route('elseyyid.translations.lang',$request->newLang)->with(config('elseyyid-location.message_success_variable'), 'Language '.$request->newLang. ' Created!'); } public function newString(NewStringFormRequest $request) { $string = Strings::where('en',$request->newString)->first(); if (!isset($string->code)) { Strings::create(['en' => $request->newString]); } return redirect()->back()->with(config('elseyyid-location.message_success_variable'), 'String '.$request->newString. ' Created!'); } public function search(SearchFormRequest $request) { $search_value = $request->search; $fields = collect(\DB::getSchemaBuilder()->getColumnListing('strings')); $columns = $fields->flip()->except(['code','created_at','updated_at'])->keys(); $query = Strings::select('*'); $query->where('en', 'LIKE', '%' . $search_value . '%'); foreach($columns as $column) { $query->orWhere($column, 'LIKE', '%' . $search_value . '%'); } $result = $query->get(); return view('langs::search_result')->with('result', $result)->with('search_value', $search_value); } public function string($code) { $string = Strings::find($code); return view('langs::lang')->with('string', $string); } public function publishAll() { $fields = collect(\DB::getSchemaBuilder()->getColumnListing('strings')); $columns = $fields->flip()->except(['code','en','created_at','updated_at'])->keys(); foreach ($columns as $lang) { $list = Strings::pluck($lang,'en'); $json = json_encode_prettify($list); $this->files->put(base_path('lang/'.$lang.'.json'),$json); } return redirect()->back()->with(config('elseyyid-location.message_success_variable'), __('All Json Files Published!')); } } PK JCW]®(K src/Services/Helper.phpnu „[µü¤ 'required', ]; } } PK JCW]ãPŠæ # src/Requests/NewLangFormRequest.phpnu „[µü¤ 'required', ]; } } PK JCW]µ‹^” " src/Requests/SearchFormRequest.phpnu „[µü¤ 'required', ]; } } PK JCW]¤+2â src/Models/Strings.phpnu „[µü¤ {{__('Languages installed')}} @foreach ($langs as $lang)
| @foreach ($value->toArray() as $key => $element) @if ($key !== 'code') | {{$element}} | @endif @endforeachShow |