Skip to content

Commit

Permalink
add AccountType enum
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjektGopher committed Feb 14, 2022
1 parent 06f9b07 commit 56ea978
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
13 changes: 13 additions & 0 deletions app/Models/AccountType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Models;

enum AccountType: string
{
case FREE = 'free';
case PAID = 'paid';
case SPONSOR = 'sponsor';
case ADMIN = 'admin';
case DEVELOPER = 'developer';

}
11 changes: 7 additions & 4 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace App\Models;

use App\Models\AccountType;
use Laravel\Sanctum\HasApiTokens;
use Laravel\Jetstream\HasProfilePhoto;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
Expand All @@ -27,6 +28,7 @@ class User extends Authenticatable
'name',
'email',
'password',
'account_type',
'twitter_id',
'twitter_nickname',
'twitter_avatar',
Expand All @@ -53,6 +55,7 @@ class User extends Authenticatable
*/
protected $casts = [
'email_verified_at' => 'datetime',
'account_type' => AccountType::class,
];

/**
Expand Down
2 changes: 2 additions & 0 deletions database/migrations/2014_10_12_000000_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public function up()
$table->foreignId('current_team_id')->nullable();
$table->timestamps();

$table->string('account_type')->nullable();

// Twitter specific
$table->string('twitter_id')->unique()->nullable();
$table->string('twitter_nickname')->unique()->nullable();
Expand Down

0 comments on commit 56ea978

Please sign in to comment.