mirror of https://github.com/4xmen/xshop.git
WIP: add multilang system
parent
099b150992
commit
254d0b9683
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Xlang;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class XlangController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Xlang;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class XlangController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Xlang $xlang
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Xlang $xlang)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\Xlang
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $tag
|
||||
* @property int $rtl
|
||||
* @property int $is_default
|
||||
* @property string|null $img
|
||||
* @property int $sort
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Database\Factories\XlangFactory factory($count = null, $state = [])
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereImg($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereIsDefault($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereRtl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereSort($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereTag($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Xlang whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Xlang extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Xlang>
|
||||
*/
|
||||
class XlangFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?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::create('xlangs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('tag',7);
|
||||
$table->boolean('rtl')->default(false);
|
||||
$table->boolean('is_default')->default(false);
|
||||
$table->string('img')->nullable()->default(null);
|
||||
$table->tinyInteger('sort')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('xlangs');
|
||||
}
|
||||
};
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Xlang;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class XlangSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
$lang = new Xlang();
|
||||
$lang->tag = 'fa';
|
||||
$lang->rtl = true;
|
||||
$lang->is_default = true;
|
||||
$lang->name = 'پارسی';
|
||||
$lang->save();
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue