added translator engine

improved ui/ux some pages (add btn)
WIP: website route to apply translate for vistor
pull/36/head
A1Gard 9 months ago
parent c01a88b731
commit c91c3710f9

@ -4,12 +4,22 @@ namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\XlangSaveRequest;
use App\Models\Cat;
use App\Models\Product;
use App\Models\Prop;
use App\Models\Setting;
use App\Models\Xlang;
use Illuminate\Http\Request;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Artisan;
use Xmen\StarterKit\Models\Category;
use Xmen\StarterKit\Models\Clip;
use Xmen\StarterKit\Models\Gallery;
use Xmen\StarterKit\Models\Image;
use Xmen\StarterKit\Models\MenuItem;
use Xmen\StarterKit\Models\Post;
use Xmen\StarterKit\Models\Slider;
use function Xmen\StarterKit\Helpers\logAdmin;
use function Xmen\StarterKit\Helpers\logAdminBatch;
@ -17,6 +27,20 @@ const PREFIX_PATH = __DIR__ . '/../../../../';
class XlangController extends Controller
{
public $allowedModels = [
Product::class,
Cat::class,
Post::class,
Category::class,
Slider::class,
MenuItem::class,
Gallery::class,
Clip::class,
Prop::class,
Setting::class,
Image::class
];
public function createOrUpdate(Xlang $xlang, XlangSaveRequest $request)
{
$xlang->name = $request->input('name');
@ -162,6 +186,7 @@ class XlangController extends Controller
define("TRANSLATE_FILE", PREFIX_PATH . 'resources/lang/' . $tag . '.json');
return response()->download(TRANSLATE_FILE, $tag . '.json');
}
public function ai($tag)
{
@ -178,7 +203,7 @@ class XlangController extends Controller
$response = $client->post($url,
['body' => $file]
);
file_put_contents(TRANSLATE_FILE,$response->getBody());
file_put_contents(TRANSLATE_FILE, $response->getBody()->getContents());
return redirect()->back()->with(['message' => __("Translated by ai xstack service:") . ' ' . $tag]);
}
@ -208,6 +233,73 @@ class XlangController extends Controller
default:
$msg = __('Unknown bulk action :' . $request->input('bulk'));
}
return redirect()->route('admin.customer.index')->with(['message' => $msg]);
return redirect()->route('admin.lang.index')->with(['message' => $msg]);
}
public function translateModel($id, $model)
{
if (!in_array($model, $this->allowedModels)) {
return abort(404);
}
$langs = Xlang::where('is_default', 0)->get();
$cls = $model;
$model = ($model)::where('id', $id)->firstOrFail();
// return $model;
$translates = $model->translatable;
return view('admin.langs.translate', compact('model', 'translates', 'langs', 'cls'));
}
public function translateModelSave($id, $model, Request $request)
{
if (!in_array($model, $this->allowedModels)) {
return abort(404);
}
$langs = Xlang::where('is_default', 0)->get();
$model = ($model)::where('id', $id)->firstOrFail();
// $model = Product::whereId('id',$id)->first();
foreach ($request->input('data') as $lang => $items) {
foreach ($items as $k => $item) {
if ($item != null) {
$model->setTranslation($k, $lang, $item);
}
}
}
$model->save();
return redirect()->back()->with(['message' => __('Translate updated')]);
}
public function translateModelAi($id, $model, $tag, $field)
{
if (!in_array($model, $this->allowedModels)) {
return abort(404);
}
$langs = Xlang::where('is_default', 0)->get();
$model = ($model)::where('id', $id)->firstOrFail();
// $model = Product::whereId('id',$id)->first();
$url = 'http://5.255.98.77:3001/text?form=' . config('app.xlang_main') . '&to=' . $tag;
$client = new Client([
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
$response = $client->post($url,
['form_params' => ['body' => $model->$field]],
);
// file_put_contents(TRANSLATE_FILE, $response->getBody());
if ($response->getStatusCode() != 200) {
return redirect()->back()->withErrors(__("API error!"));
}
// dd($response->getBody()->getContents());
$model->setTranslation($field, $tag, $response->getBody()->getContents());
$model->save();
return redirect()->back()->with(['message' => __('Translate updated')]);
}
}

@ -34,7 +34,7 @@
"psr/log": "v2.*",
"symfony/dom-crawler": "^6.2",
"symfony/psr-http-message-bridge": "^7.0",
"xmen/starter-kit": "^v3.1.0"
"xmen/starter-kit": "^v3.2.5"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.12",

14
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "476fc03eaacbf9c04610c95da580105c",
"content-hash": "38e039d93317f0accb46bc58aa69b9e1",
"packages": [
{
"name": "artesaos/seotools",
@ -8421,16 +8421,16 @@
},
{
"name": "xmen/starter-kit",
"version": "v3.2.2",
"version": "v3.2.5",
"source": {
"type": "git",
"url": "https://github.com/4xmen/starterkit-for-laravel.git",
"reference": "e06fae15e94831babebb1ab3ba4c7f5c57f85a5e"
"reference": "207cafd1abb67f9a0768223f32490e69d1be8a8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/4xmen/starterkit-for-laravel/zipball/e06fae15e94831babebb1ab3ba4c7f5c57f85a5e",
"reference": "e06fae15e94831babebb1ab3ba4c7f5c57f85a5e",
"url": "https://api.github.com/repos/4xmen/starterkit-for-laravel/zipball/207cafd1abb67f9a0768223f32490e69d1be8a8d",
"reference": "207cafd1abb67f9a0768223f32490e69d1be8a8d",
"shasum": ""
},
"require": {
@ -8489,9 +8489,9 @@
],
"support": {
"issues": "https://github.com/4xmen/starterkit-for-laravel/issues",
"source": "https://github.com/4xmen/starterkit-for-laravel/tree/v3.2.2"
"source": "https://github.com/4xmen/starterkit-for-laravel/tree/v3.2.5"
},
"time": "2024-02-04T12:31:22+00:00"
"time": "2024-02-04T23:17:48+00:00"
}
],
"packages-dev": [

@ -4,7 +4,7 @@ use Translator\Framework\LaravelConfigLoader;
use Translator\Infra\LaravelJsonTranslationRepository;
return [
'languages' => ["fa","ru","ar"],
'languages' => ["fa","ru","ar","fr"],
'directories' => [
app_path(),
resource_path('views'),

@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('posts', function ($table) {
$table->text('title')->change();
});
Schema::table('categories', function ($table) {
$table->text('name')->change();
});
Schema::table('cats', function ($table) {
$table->text('name')->change();
});
Schema::table('products', function ($table) {
$table->text('name')->change();
});
Schema::table('props', function ($table) {
$table->text('label')->change();
});
Schema::table('galleries', function ($table) {
$table->text('title')->change();
});
Schema::table('menu_items', function ($table) {
$table->text('title')->change();
});
Schema::table('images', function ($table) {
$table->text('title')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};

@ -3734,6 +3734,63 @@ nav a {
color: rgba(255, 255, 255, 0.3333333333);
}
.lang-support {
background: dodgerblue;
color: white;
padding: 7px;
text-align: center;
font-weight: 300;
margin-top: 1rem;
}
.btn-ai {
height: 65px;
width: 65px;
background: dodgerblue;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0.1333333333);
}
.btn-ai:hover {
box-shadow: inset 0 0 0 75px rgba(0, 0, 0, 0.1333333333);
}
.btn-add {
height: 50px;
width: 50px;
background: #333;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0.1333333333);
position: fixed;
left: 1rem;
bottom: 1rem;
text-decoration: none;
}
.btn-add:hover {
box-shadow: inset 0 0 0 75px rgba(0, 0, 0, 0.1333333333);
}
.img-squire {
width: 100%;
height: 175px;
-o-object-fit: cover;
object-fit: cover;
}
/*-768px width*/
@media (max-width: 1000px) {
.gird4 {
@ -3800,3 +3857,7 @@ nav a {
right: auto !important;
left: 2rem !important;
}
.no-dec a {
text-decoration: none;
}

@ -26,7 +26,9 @@
":app Dear customer Your :product signed for you.": ":app\nکاربر گرامی محصول «:product» برای شما ثبت شد.",
"A fresh verification link has been sent to your email address.": "یک لینک تاییده برای شما ایمیل شد",
"ACL": "سطح دسترسی",
"AI translate form original source": "",
"ANSWERED": "پاسخ‌ داده شده",
"API error!": "",
"Action": "عملیات",
"Actions": "عملیات",
"Active": "فعال",
@ -276,6 +278,7 @@
"Magazine": "مجله",
"Main address": "آدرس اصلی",
"Main category": "سرفصل اصلی",
"Main language content": "",
"Main product category": "دسته اصلی محصول",
"Manage": "مدیریت",
"Max click": "حداکثر تعداد کلیک",
@ -510,6 +513,7 @@
"Total amount": "مقدار کل",
"Tracking code": "کد رهگیری",
"Translate": "ترجمان",
"Translate model": "",
"Translate updated": "ترجمه به روز شد",
"Translate with AI": "ترجمه با کمک هوش مصنوعی",
"Translated by ai xstack service:": "",
@ -536,6 +540,7 @@
"Username": "نام کاربری",
"Users": "کاربران",
"Users list": "فهرست کاربران",
"Value": "",
"Verify Your Email Address": "تایید رایانامه یا ایمیل خود",
"Video clip": "ویدئو کلیپ",
"Video clips": "کلیپ ها",

@ -6,6 +6,8 @@
"$log->action": "$log->действие",
":app Dear customer Your :product signed for you.": ":app Уважаемый клиент, ваш :product подписан для вас.",
"A fresh verification link has been sent to your email address.": "На ваш адрес электронной почты была отправлена новая ссылка для подтверждения.",
"AI translate form original source": "",
"API error!": "",
"Action": "Действие",
"Actions": "Действия",
"Active": "Активный",
@ -69,6 +71,7 @@
"City": "Город",
"Click": "Нажмите",
"Click here to upload or drag and drop here": "Нажмите здесь для загрузки или перетащите сюда",
"Clip": "",
"Clip list": "Список клипов",
"Clips": "Клипы",
"Code": "Код",
@ -211,6 +214,7 @@
"Magazine": "«Журнал»",
"Main address": "«Основной адрес»",
"Main category": "Главная категория",
"Main language content": "",
"Main product category": "«Основная категория товаров»",
"Manage": "Управлять",
"Max click": "«Макс клик»",
@ -319,6 +323,7 @@
"Properties list": "«Список свойств»",
"Properties meta": "«Мета свойства»",
"Properties sort": "«Сортировка свойств»",
"Props": "",
"Publish now": "«Опубликовать сейчас»",
"Published": "Опубликовано",
"Quantity": "Количество",
@ -404,6 +409,7 @@
"Total Price": "Итоговая цена",
"Total amount": "Общая сумма",
"Tracking code": "Код отслеживания",
"Translate model": "",
"Translate updated": "",
"Translate with AI": "",
"Translated by ai xstack service:": "",
@ -429,6 +435,7 @@
"Username": "Имя пользователя",
"Users": "«Пользователи»",
"Users list": "«Список пользователей»",
"Value": "",
"Verify Your Email Address": "Проверьте свой адрес электронной почты",
"Video clip": "Видеоклип",
"Video clips": "Видеоклипы",

@ -183,6 +183,63 @@ nav {
color: #ffffff55;
}
.lang-support{
background: dodgerblue;
color: white;
padding: 7px;
text-align: center;
font-weight: 300;
margin-top: 1rem;
}
.btn-ai{
height: 65px;
width: 65px;
background: dodgerblue;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 #00000022;
&:hover{
box-shadow: inset 0 0 0 75px #00000022;
}
}
.btn-add{
height: 50px;
width: 50px;
background: #333;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 #ffffff22;
position: fixed;
left: 1rem;
bottom: 1rem;
text-decoration: none;
&:hover{
box-shadow: inset 0 0 0 75px #00000022;
}
}
.img-squire{
width: 100%;
height: 175px;
object-fit: cover;
}
/*-768px width*/
@media ( max-width: 1000px ) {
.gird4 {
@ -250,3 +307,9 @@ nav {
right: auto !important;
left: 2rem !important;
}
.no-dec{
a{
text-decoration: none;
}
}

@ -26,8 +26,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.cat.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -49,14 +47,18 @@
</td>
<td>
<a href="{{route('admin.cat.edit',$cat->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp;
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.cat.delete',$cat->slug)}}"
class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp;
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$cat->id,\App\Models\Cat::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td>
</tr>
@endforeach
@ -67,5 +69,8 @@
<div class="text-center pt-3">
{{$cats->links()}}
</div>
<a class="btn-add" href="{{route('admin.cat.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -27,8 +27,7 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.lang.create')}}" class="btn btn-success btn-sm float-end"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -56,13 +55,11 @@
</td>
<td>
<a href="{{route('admin.lang.edit',$n->id)}}" class="btn btn-primary btn-sm">
<i class="fa fa-edit"></i> &nbsp;
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.lang.delete',$n->id)}}"
class="btn btn-danger delete-confirm btn-sm">
<i class="fa fa-times"></i> &nbsp;
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
</td>
</tr>
@ -74,5 +71,8 @@
<div class="text-center pt-3">
{{$langs->links()}}
</div>
<a class="btn-add" href="{{route('admin.lang.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -0,0 +1,82 @@
@extends('admin.adminlayout')
@section('page_title')
{{__("Translate model")}}: {{($model->{$translates[0]})}}
-
@endsection
@section('content')
<div class="container">
@include('starter-kit::component.err')
<h3>
{{__("Translate model")}}: {{($model->{$translates[0]})}}
</h3>
<h4 class="lang-support">
{{__("Main language content")}}:({{config('app.xlang_main')}})
</h4>
<table class="table table-bordered">
<tr>
<th>
{{__("Title")}}
</th>
<th>
{{__("Value")}}
</th>
</tr>
@foreach($translates as $tr)
<tr>
<th>
{{$tr}}
</th>
<th>
{{($model->{$tr})}}
</th>
</tr>
@endforeach
</table>
<form action="{{route( 'admin.lang.modelSave',[$model->id,$cls])}}" method="post">
@csrf
@foreach($langs as $lang)
<h4 class="lang-support">
{{__("Translate model")}}: {{$lang->name}} ({{$lang->tag}})
</h4>
@foreach($translates as $tr)
<div class="form-group mt-2">
<label for="{{$lang->tag}}{{$tr}}">
{{$tr}}:
</label>
<div class="row">
<div class="col-md-10">
@if( $tr == 'body' || $tr == 'desc' || $tr == 'description' || $tr == 'excerpt' )
<textarea
class="form-control @if($tr == 'body' || $tr == 'desc' || $tr == 'description' ) ckeditorx @endif"
rows="4" id="{{$lang->tag}}{{$tr}}"
name="data[{{$lang->tag}}][{{$tr}}]">{{gettype($model->getTranslation($tr,$lang->tag)) == 'string' ? $model->getTranslation($tr,$lang->tag):'' }}</textarea>
@else
<input type="text" id="{{$lang->tag}}{{$tr}}" name="data[{{$lang->tag}}][{{$tr}}]"
value="{{gettype($model->getTranslation($tr,$lang->tag)) == 'string' ? $model->getTranslation($tr,$lang->tag):'' }}"
placeholder="" class="form-control">
@endif
</div>
<div class="col-md-2 d-flex align-items-center">
<a href="{{route('admin.lang.aiText',[$model->id,$cls,$lang->tag,$tr])}}" class="btn-ai" title="{{__("AI translate form original source")}}">
<i class="ri-translate"></i>
</a>
</div>
</div>
</div>
@endforeach
@endforeach
<button class="btn btn-outline-dark w-100 my-3">
{{__("Save")}}
</button>
</form>
</div>
@endsection

@ -54,7 +54,7 @@
<div class="row">
@foreach($langs as $lang)
<div class="col-md-4">
<div class="col-md-4 mb-4">
<div class="lang-item">
<h5>
{{$lang->name}}

@ -51,8 +51,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.product.create')}}" class="btn btn-success float-end"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -78,15 +76,19 @@
</td>
<td>
<a href="{{route('admin.product.edit',$n->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp;
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
@if($n->deleted_at == null)
<a href="{{route('admin.product.delete',$n->slug)}}"
class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp;
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\App\Models\Product::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
@else
<a href="{{route('admin.product.restore',$n->slug)}}"
class="btn btn-success">
@ -105,5 +107,8 @@
<div class="text-center pt-3">
{{$products->links()}}
</div>
<a class="btn-add" href="{{route('admin.post.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -2,10 +2,8 @@
@section('content')
<div class="container">
<h5 class="text-center"> {{__("Properties list")}}
<a class="btn btn-primary float-start" href="{{route('admin.props.create')}}">
<i class="fa fa-plus"></i>
</a>
<h5 class="text-center">
{{__("Properties list")}}
</h5>
<div class="table-responsive">
@ -33,7 +31,7 @@
<td>
{{$p->type}}
</td>
<td>
<td class="no-dec">
@if(isset($p->category))
@foreach($p->category as $c)
<a href="{{route('admin.props.sort',$c->id)}}">
@ -49,14 +47,20 @@
<a title="Edit"
class="btn btn-secondary ad-accept-btn"
href="{{route('admin.props.edit',$p->id)}}">
<i class="fa fa-edit"></i>
<i class="ri-edit-2-line"></i>
</a>
&nbsp;
<a title="Dlete"
class="btn btn-danger cdelete"
href="{{route('admin.props.delete',$p->id)}}">
<i class="fa fa-times"></i>
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$p->id,\App\Models\Prop::class])}}"
class="btn btn-outline-dark translat-btn mx-1">
<i class="ri-translate"></i>
</a>
@endif
</div>
</td>
</tr>
@ -68,4 +72,9 @@
</div>
</div>
</div>
<a class="btn-add" href="{{route('admin.props.create')}}">
<i class="ri-add-line"></i>
</a>
@endsection

@ -23,8 +23,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.category.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -43,14 +41,18 @@
</td>
<td>
<a href="{{route('admin.category.edit',$cat->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp;
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.category.delete',$cat->slug)}}"
class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp;
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$cat->id,\Xmen\StarterKit\Models\Category::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td>
</tr>
@endforeach
@ -62,4 +64,8 @@
{{$cats->links()}}
</div>
</div>
<a class="btn-add" href="{{route('admin.category.create')}}">
<i class="ri-add-line"></i>
</a>
@endsection

@ -46,8 +46,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.clip.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -69,11 +67,17 @@
</td>
<td>
<a href="{{route('admin.clip.edit',$pl->slug)}}" class="btn btn-secondary">
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.clip.delete',$pl->slug)}}" class="btn btn-danger del-conf">
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\Xmen\StarterKit\Models\Clip::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td>
</tr>
@endforeach
@ -83,5 +87,9 @@
</form>
<br>
{{$clips->links()}}
<a class="btn-add" href="{{route('admin.clip.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -97,17 +97,30 @@
<div class="card-body">
<form action="{{route('admin.gallery.updatetitle',$gallery->slug)}}" method="post">
@csrf
<div class="row">
@foreach($gallery->images as $img)
<div class="img-preview">
<div class="col-md-3">
<a href="{{route('admin.image.delete',$img->id)}}" class="del-conf">
<i class="fa fa-times"></i>
</a>
<img src="{{$img->imgUrl()}}" alt="">
<h4>
<img src="{{$img->imgUrl()}}" class="img-squire" alt="">
<div class="row">
<div class="col-md-9">
<input type="text" class="form-control" name="titles[{{$img->id}}]" value="{{$img->title}}"/>
</h4>
</div>
<div class="col-md-3">
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$img->id,\Xmen\StarterKit\Models\Image::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</div>
</div>
</div>
@endforeach
</div>
<br>
<input type="submit" class="btn btn-primary" value="{{__("Save")}}"/>
</form>

@ -40,8 +40,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.gallery.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -65,14 +63,18 @@
</td>
<td>
<a href="{{route('admin.gallery.edit',$n->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp;
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.gallery.delete',$n->slug)}}"
class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp;
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\Xmen\StarterKit\Models\Gallery::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td>
</tr>
@endforeach
@ -83,5 +85,8 @@
<div class="text-center pt-3">
{{$galleries->links()}}
</div>
<a class="btn-add" href="{{route('admin.gallery.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -40,8 +40,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.post.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -65,14 +63,18 @@
</td>
<td>
<a href="{{route('admin.post.edit',$n->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp;
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.post.delete',$n->slug)}}"
class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp;
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\Xmen\StarterKit\Models\Post::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td>
</tr>
@endforeach
@ -83,5 +85,8 @@
<div class="text-center pt-3">
{{$posts->links()}}
</div>
<a class="btn-add" href="{{route('admin.post.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -8,9 +8,6 @@
<div class="container">
<h1>
{{__("Slider list")}}
<a href="{{route('admin.slider.create')}}" class="btn btn-success float-start">
{{__("New Slider")}}
</a>
</h1>
@include('starter-kit::component.err')
<div class="alert alert-dark">
@ -44,8 +41,6 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.slider.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th>
</tr>
</thead>
@ -64,11 +59,17 @@
</td>
<td>
<a href="{{route('admin.slider.edit',$pl->id)}}" class="btn btn-secondary">
{{__("Edit")}}
<i class="ri-edit-2-line"></i>
</a>
<a href="{{route('admin.slider.delete',$pl->id)}}" class="btn btn-danger del-conf">
{{__("Delete")}}
<i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$pl->id,\Xmen\StarterKit\Models\Slider::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td>
</tr>
@endforeach
@ -78,5 +79,8 @@
</form>
<br>
{{$sliders->links()}}
<a class="btn-add" href="{{route('admin.cat.create')}}">
<i class="ri-add-line"></i>
</a>
</div>
@endsection

@ -43,6 +43,9 @@ Route::prefix(config('starter-kit.uri'))->name('admin.')->group(
Route::get('/download/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'download'])->name('download');
Route::get('/ai/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'ai'])->name('ai');
Route::post('/upload/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'upload'])->name('upload');
Route::get('/model/translate/{id}/{model}', [\App\Http\Controllers\Admin\XlangController::class,'translateModel'])->name('model');
Route::post('/model/translate/save/{id}/{model}', [\App\Http\Controllers\Admin\XlangController::class,'translateModelSave'])->name('modelSave');
Route::get('/model/ai/{id}/{model}/{field}/{lang}', [\App\Http\Controllers\Admin\XlangController::class,'translateModelAi'])->name('aiText');
});

Loading…
Cancel
Save