generated from liutk/owl-admin-base
上报数据任务增加店长
parent
0a9fe3dc4a
commit
4ca6e78619
|
|
@ -63,7 +63,7 @@ class TaskLedgerGenerateCommand extends Command
|
||||||
return $planable->setRelation('plan', $plan);
|
return $planable->setRelation('plan', $plan);
|
||||||
});
|
});
|
||||||
|
|
||||||
$stores = Store::all();
|
$stores = Store::with(['master'])->all();
|
||||||
|
|
||||||
/** @var \App\Models\Store */
|
/** @var \App\Models\Store */
|
||||||
foreach ($stores as $store) {
|
foreach ($stores as $store) {
|
||||||
|
|
@ -71,6 +71,8 @@ class TaskLedgerGenerateCommand extends Command
|
||||||
$taskable = TaskLedger::firstOrNew([
|
$taskable = TaskLedger::firstOrNew([
|
||||||
'store_id' => $store->id,
|
'store_id' => $store->id,
|
||||||
'date' => $planable->date,
|
'date' => $planable->date,
|
||||||
|
], [
|
||||||
|
'store_master_id' => $store->master?->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($taskable->exists) {
|
if ($taskable->exists) {
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ class TaskLedger extends Model
|
||||||
use HasFactory, HasDateTimeFormatter;
|
use HasFactory, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'store_id',
|
|
||||||
'date',
|
'date',
|
||||||
|
'store_id',
|
||||||
|
'store_master_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function task(): MorphOne
|
public function task(): MorphOne
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ return new class extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('task_ledgers', function (Blueprint $table) {
|
Schema::create('task_ledgers', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('store_id')->comment('门店ID');
|
|
||||||
$table->date('date')->comment('日期');
|
$table->date('date')->comment('日期');
|
||||||
|
$table->foreignId('store_id')->comment('门店ID');
|
||||||
|
$table->foreignId('store_master_id')->comment('店长');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue