会员组页面返回语言
This commit is contained in:
parent
fda45c9c8c
commit
03190064ad
|
|
@ -14,6 +14,7 @@ namespace Beike\Admin\Http\Controllers;
|
|||
use Beike\Admin\Http\Requests\CustomerGroupRequest;
|
||||
use Beike\Admin\Services\CustomerGroupService;
|
||||
use Beike\Repositories\CustomerGroupRepo;
|
||||
use Beike\Repositories\LanguageRepo;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomerGroupController extends Controller
|
||||
|
|
@ -25,6 +26,7 @@ class CustomerGroupController extends Controller
|
|||
|
||||
$data = [
|
||||
'customer_groups' => $customers,
|
||||
'languages' => LanguageRepo::all(),
|
||||
];
|
||||
|
||||
return view('admin::pages.customer_groups.index', $data);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* Language.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author TL <mengwb@opencart.cn>
|
||||
* @created 2022-07-05 16:32:18
|
||||
* @modified 2022-07-05 16:32:18
|
||||
*/
|
||||
|
||||
namespace Beike\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Language extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name', 'code', 'locale', 'image', 'sort_order', 'status'];
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* LanguageRepo.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author TL <mengwb@opencart.cn>
|
||||
* @created 2022-07-05 16:38:18
|
||||
* @modified 2022-07-05 16:38:18
|
||||
*/
|
||||
|
||||
namespace Beike\Repositories;
|
||||
|
||||
|
||||
use Beike\Models\Language;
|
||||
|
||||
class LanguageRepo
|
||||
{
|
||||
/**
|
||||
* 创建一个language记录
|
||||
* @param $data
|
||||
* @return int
|
||||
*/
|
||||
public static function create($data)
|
||||
{
|
||||
return Language::query()->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $data
|
||||
* @return bool|int
|
||||
*/
|
||||
public static function update($id, $data)
|
||||
{
|
||||
$item = Language::query()->find($id);
|
||||
if (!$item) {
|
||||
throw new \Exception("语言id {$id} 不存在");
|
||||
}
|
||||
$item->update($data);
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public static function find($id)
|
||||
{
|
||||
return Language::query()->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return void
|
||||
*/
|
||||
public static function delete($id)
|
||||
{
|
||||
$item = Language::query()->find($id);
|
||||
if ($item) {
|
||||
$item->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static function all()
|
||||
{
|
||||
return Language::query()->get();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue