Skip to content

Commit

Permalink
Add extra pro users via env
Browse files Browse the repository at this point in the history
  • Loading branch information
JhumanJ committed Oct 12, 2023
1 parent 32fd9f8 commit c02af78
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 87 deletions.
3 changes: 0 additions & 3 deletions app/Http/Controllers/SubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ class SubscriptionController extends Controller
const SUBSCRIPTION_PLANS = ['monthly', 'yearly'];

const PRO_SUBSCRIPTION_NAME = 'default';
const ENTERPRISE_SUBSCRIPTION_NAME = 'enterprise';

const SUBSCRIPTION_NAMES = [
self::PRO_SUBSCRIPTION_NAME,
self::ENTERPRISE_SUBSCRIPTION_NAME
];

/**
Expand Down
15 changes: 4 additions & 11 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Notifications\Notifiable;
use Laravel\Cashier\Billable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class User extends Authenticatable implements JWTSubject //, MustVerifyEmail
class User extends Authenticatable implements JWTSubject
{
use Notifiable, HasFactory, Billable;

Expand Down Expand Up @@ -81,12 +79,7 @@ public function getHasFormsAttribute()

public function getIsSubscribedAttribute()
{
return $this->subscribed() || $this->subscribed(SubscriptionController::ENTERPRISE_SUBSCRIPTION_NAME);
}

public function getHasEnterpriseSubscriptionAttribute()
{
return $this->subscribed(SubscriptionController::ENTERPRISE_SUBSCRIPTION_NAME);
return $this->subscribed() || in_array($this->email, config('opnform.extra_pro_users_emails'));
}

public function getHasCustomerIdAttribute()
Expand All @@ -96,12 +89,12 @@ public function getHasCustomerIdAttribute()

public function getAdminAttribute()
{
return in_array($this->email, config('services.admin_emails'));
return in_array($this->email, config('opnform.admin_emails'));
}

public function getTemplateEditorAttribute()
{
return $this->admin || in_array($this->email, config('services.template_editor_emails'));
return $this->admin || in_array($this->email, config('opnform.template_editor_emails'));
}

/**
Expand Down
Loading

0 comments on commit c02af78

Please sign in to comment.