李浩杰 4 年之前
父节点
当前提交
7d50c065cd

+ 0 - 8
app/Models/DayStat.php

@@ -1,8 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class DayStat extends BaseModel
-{
-    //
-}

+ 0 - 34
database/migrations/2020_12_21_102516_create_day_stats_table.php

@@ -1,34 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateDayStatsTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('day_stats', function (Blueprint $table) {
-            $table->increments('id');
-            $table->date('date')->nullable();
-            $table->unsignedInteger('device_id')->nullable();
-            $table->unsignedInteger('money')->nullable();
-            $table->timestamps();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('day_stats');
-    }
-}

+ 0 - 30
database/migrations/2020_12_21_105350_add_project_id_today_stats.php

@@ -1,30 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddProjectIdTodayStats extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::table('day_stats', function (Blueprint $table) {
-            $table->unsignedInteger('project_id')->after('device_id')->nullable();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        //
-    }
-}

+ 0 - 26
database/seeds/DayStatSeeder.php

@@ -1,26 +0,0 @@
-<?php
-
-use Illuminate\Database\Seeder;
-
-class DayStatSeeder extends Seeder
-{
-    /**
-     * Run the database seeds.
-     *
-     * @return void
-     */
-    public function run()
-    {
-        $devices = \App\Models\Device::all();
-        \App\Models\DayStat::truncate();
-        $projects = \App\Models\Project::all();
-        for($i = 0; $i < 100; $i++) {
-            \App\Models\DayStat::create([
-                'date' => \Carbon\Carbon::now()->subDays(mt_rand(1, 100))->toDateString(),
-                'device_id' => $devices->random()->id,
-                'project_id' => $projects->random()->id,
-                'money' => mt_rand(1000, 9999)
-            ]);
-        }
-    }
-}