语言管理
This commit is contained in:
parent
03190064ad
commit
700b1070a5
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* LanguageController.php
|
||||||
|
*
|
||||||
|
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||||
|
* @link http://www.guangdawangluo.com
|
||||||
|
* @author TL <mengwb@opencart.cn>
|
||||||
|
* @created 2022-07-05 16:37:04
|
||||||
|
* @created 2022-07-05 16:37:04
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Beike\Admin\Http\Controllers;
|
||||||
|
|
||||||
|
use Beike\Repositories\LanguageRepo;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class LanguageController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$languages = LanguageRepo::all();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'languages' => $languages,
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin::pages.languages.index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$language = LanguageRepo::create($request->only('name', 'code', 'locale', 'image', 'sort_order', 'status'));
|
||||||
|
|
||||||
|
return json_success('创建成功', $language);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, int $id)
|
||||||
|
{
|
||||||
|
$language = LanguageRepo::update($id, $request->only('name', 'code', 'locale', 'image', 'sort_order', 'status'));
|
||||||
|
|
||||||
|
return json_success('更新成功!', $language);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, int $currencyId)
|
||||||
|
{
|
||||||
|
CurrencyRepo::delete($currencyId);
|
||||||
|
|
||||||
|
return json_success('删除成功!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateLanguageTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('languages', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name', 64);
|
||||||
|
$table->string('code', 16);
|
||||||
|
$table->string('locale', 255);
|
||||||
|
$table->string('image', 255);
|
||||||
|
$table->integer('sort_order');
|
||||||
|
$table->tinyInteger('status');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('languages');
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue