first
This commit is contained in:
22
modules/Mall/Http/Controllers/Admin/WithShop.php
Normal file
22
modules/Mall/Http/Controllers/Admin/WithShop.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin;
|
||||
|
||||
use Modules\Mall\Models\Shop;
|
||||
|
||||
trait WithShop
|
||||
{
|
||||
|
||||
public function shop($form)
|
||||
{
|
||||
return $form->select('shop_id', '所属店铺')
|
||||
->options(function ($shopId) {
|
||||
$shop = Shop::find($shopId);
|
||||
if ($shop) {
|
||||
return [$shop->id => $shop->name];
|
||||
}
|
||||
})
|
||||
->ajax(route('admin.mall.shops.ajax'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user