fix: add info last_connected_at & installed_at

v2.0.0
ricky rx 2 years ago
parent 7118fea237
commit d947df81d3

@ -23,6 +23,8 @@ class TvController extends Controller {
$latestVideoUpdate = null; $latestVideoUpdate = null;
if($request->id) { if($request->id) {
$tv = Tv::find($request->id); $tv = Tv::find($request->id);
$tv->last_connected_at = now();
$tv->save();
$latestApkUpdate = ApkUpdate::getLatest(); $latestApkUpdate = ApkUpdate::getLatest();
$latestVideoUpdate = VideoUpdate::getLatestSelected(); $latestVideoUpdate = VideoUpdate::getLatestSelected();
} }

@ -167,6 +167,8 @@ class NewTvRequest extends Model {
$tv->col10 = $tvRequest->col10; $tv->col10 = $tvRequest->col10;
$tv->notes = $tvRequest->notes; $tv->notes = $tvRequest->notes;
$tv->device_info = $newTvReq->device_info; $tv->device_info = $newTvReq->device_info;
$tv->installed_at = now();
$tv->last_connected_at = now();
$tv->save(); $tv->save();
$newTvReq->activated_at = now(); $newTvReq->activated_at = now();

@ -40,13 +40,6 @@ class Tv extends Model {
//------------------------------------------------------------ //------------------------------------------------------------
// -- RELATED TO DATA FUNCTION // -- 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 // -- END RELATED TO DATA FUNCTION
//------------------------------------------------------------ //------------------------------------------------------------

@ -27,7 +27,7 @@ return new class extends Migration {
$table->string('notes', 255)->nullable(); $table->string('notes', 255)->nullable();
$table->boolean('is_active')->default(true); $table->boolean('is_active')->default(true);
$table->jsonb('device_info')->nullable(); $table->jsonb('device_info')->nullable();
$table->timestampTz('installed_at')->nullable(); $table->timestampTz('installed_at');
$table->timestampTz('last_connected_at')->nullable(); $table->timestampTz('last_connected_at')->nullable();
$table->timestampsTz(); $table->timestampsTz();
}); });

Loading…
Cancel
Save