船舶更新
This commit is contained in:
@@ -196,6 +196,15 @@ class LocationController extends Crud
|
||||
$translatorService = new \app\service\TranslatorService();
|
||||
|
||||
foreach ($languages as $lang) {
|
||||
$locationModel = $translationModels[$lang];
|
||||
if(!empty($data['id'])){
|
||||
$location = $locationModel::find($data['id']);
|
||||
}else{
|
||||
$location = $locationModel;
|
||||
}
|
||||
unset($data['name']);
|
||||
$location->fill($data);
|
||||
$location->save();
|
||||
$translatorService->queue($data,$sourceLang,'location',$data['id']?:null,$lang);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use plugin\admin\app\model\LogisticsShip;
|
||||
use plugin\admin\app\controller\Crud;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
/**
|
||||
* 船舶信息
|
||||
*/
|
||||
class LogisticsShipController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var LogisticsShip
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new LogisticsShip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览
|
||||
* @return Response
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
return view('logistics-ship/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public function insert(Request $request): Response
|
||||
{
|
||||
if ($request->method() === 'POST') {
|
||||
return parent::insert($request);
|
||||
}
|
||||
return view('logistics-ship/insert');
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public function update(Request $request): Response
|
||||
{
|
||||
if ($request->method() === 'POST') {
|
||||
return parent::update($request);
|
||||
}
|
||||
return view('logistics-ship/update');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user