init
This commit is contained in:
232 files changed
+25416
No files matched your search
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\MobileAppFactory;
|
||||
use Filament\Models\Contracts\HasName;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
#[Fillable([
|
||||
'name',
|
||||
'package_name',
|
||||
'client_key',
|
||||
'management_key',
|
||||
'is_active',
|
||||
'maintenance_mode',
|
||||
'latest_version_name',
|
||||
'latest_version_code',
|
||||
'minimum_version_code',
|
||||
'store_url',
|
||||
'privacy_url',
|
||||
'support_email',
|
||||
'configuration',
|
||||
'feature_flags',
|
||||
'bazaar_api_secret',
|
||||
'bazaar_comments_header',
|
||||
'bazaar_comments_secret',
|
||||
'bazaar_login_client_id',
|
||||
'bazaar_login_client_secret',
|
||||
'bazaar_login_redirect_url',
|
||||
'bazaar_billing_public_key',
|
||||
'bazaar_sync_enabled',
|
||||
'bazaar_sync_interval_minutes',
|
||||
'bazaar_sync_status',
|
||||
'bazaar_sync_started_at',
|
||||
'bazaar_last_synced_at',
|
||||
'bazaar_sync_error',
|
||||
'bazaar_sync_summary',
|
||||
])]
|
||||
#[Hidden([
|
||||
'client_key',
|
||||
'management_key',
|
||||
'bazaar_api_secret',
|
||||
'bazaar_comments_secret',
|
||||
'bazaar_login_client_secret',
|
||||
'bazaar_billing_public_key',
|
||||
])]
|
||||
class MobileApp extends Model implements HasName
|
||||
{
|
||||
/** @use HasFactory<MobileAppFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $attributes = [
|
||||
'is_active' => true,
|
||||
'maintenance_mode' => false,
|
||||
'bazaar_sync_enabled' => true,
|
||||
'bazaar_sync_interval_minutes' => 15,
|
||||
'bazaar_sync_status' => 'idle',
|
||||
];
|
||||
|
||||
public function getFilamentName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getRouteKeyName(): string
|
||||
{
|
||||
return 'package_name';
|
||||
}
|
||||
|
||||
public function users(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class)->withPivot('role')->withTimestamps();
|
||||
}
|
||||
|
||||
public function bazaarPurchases(): HasMany
|
||||
{
|
||||
return $this->hasMany(BazaarPurchase::class);
|
||||
}
|
||||
|
||||
public function bazaarSubscriptions(): HasMany
|
||||
{
|
||||
return $this->hasMany(BazaarSubscription::class);
|
||||
}
|
||||
|
||||
public function bazaarReleases(): HasMany
|
||||
{
|
||||
return $this->hasMany(BazaarRelease::class);
|
||||
}
|
||||
|
||||
public function bazaarReviews(): HasMany
|
||||
{
|
||||
return $this->hasMany(BazaarReview::class);
|
||||
}
|
||||
|
||||
public function bazaarApiRequests(): HasMany
|
||||
{
|
||||
return $this->hasMany(BazaarApiRequest::class);
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'client_key' => 'encrypted',
|
||||
'management_key' => 'encrypted',
|
||||
'is_active' => 'boolean',
|
||||
'maintenance_mode' => 'boolean',
|
||||
'configuration' => 'array',
|
||||
'feature_flags' => 'array',
|
||||
'bazaar_api_secret' => 'encrypted',
|
||||
'bazaar_comments_secret' => 'encrypted',
|
||||
'bazaar_login_client_secret' => 'encrypted',
|
||||
'bazaar_billing_public_key' => 'encrypted',
|
||||
'bazaar_sync_enabled' => 'boolean',
|
||||
'bazaar_sync_interval_minutes' => 'integer',
|
||||
'bazaar_sync_started_at' => 'datetime',
|
||||
'bazaar_last_synced_at' => 'datetime',
|
||||
'bazaar_sync_summary' => 'array',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user