diff --git a/app/Http/Controllers/api/mobile/TvController.php b/app/Http/Controllers/api/mobile/TvController.php index 5b6e028..a5caae8 100644 --- a/app/Http/Controllers/api/mobile/TvController.php +++ b/app/Http/Controllers/api/mobile/TvController.php @@ -23,6 +23,8 @@ class TvController extends Controller { $latestVideoUpdate = null; if($request->id) { $tv = Tv::find($request->id); + $tv->last_connected_at = now(); + $tv->save(); $latestApkUpdate = ApkUpdate::getLatest(); $latestVideoUpdate = VideoUpdate::getLatestSelected(); } diff --git a/app/Models/NewTvRequest.php b/app/Models/NewTvRequest.php index d1305bb..0e30957 100644 --- a/app/Models/NewTvRequest.php +++ b/app/Models/NewTvRequest.php @@ -167,6 +167,8 @@ class NewTvRequest extends Model { $tv->col10 = $tvRequest->col10; $tv->notes = $tvRequest->notes; $tv->device_info = $newTvReq->device_info; + $tv->installed_at = now(); + $tv->last_connected_at = now(); $tv->save(); $newTvReq->activated_at = now(); diff --git a/app/Models/Tv.php b/app/Models/Tv.php index 031dd84..f7824c8 100644 --- a/app/Models/Tv.php +++ b/app/Models/Tv.php @@ -40,13 +40,6 @@ class Tv extends Model { //------------------------------------------------------------ // -- RELATED TO DATA FUNCTION - public static function createAnonymousData() :Tv { - $newTv = new self; - $newTv->code = self::generateRandomCode(); - $newTv->is_active = true; - $newTv->save(); - return $newTv; - } // -- END RELATED TO DATA FUNCTION //------------------------------------------------------------ diff --git a/database/migrations/2024_05_18_033105_tv.php b/database/migrations/2024_05_18_033105_tv.php index cdc5316..3822d0b 100644 --- a/database/migrations/2024_05_18_033105_tv.php +++ b/database/migrations/2024_05_18_033105_tv.php @@ -27,7 +27,7 @@ return new class extends Migration { $table->string('notes', 255)->nullable(); $table->boolean('is_active')->default(true); $table->jsonb('device_info')->nullable(); - $table->timestampTz('installed_at')->nullable(); + $table->timestampTz('installed_at'); $table->timestampTz('last_connected_at')->nullable(); $table->timestampsTz(); });