* @author James Brooks */ class Invite extends Model { use Notifiable; /** * The attributes that should be casted to native types. * * @var string[] */ protected $casts = [ 'email' => 'string', ]; /** * The fillable properties. * * @var string[] */ protected $fillable = ['email']; /** * Overrides the models boot method. * * @return void */ public static function boot() { parent::boot(); self::creating(function ($invite) { if (!$invite->code) { $invite->code = Str::random(20); } }); } /** * Determines if the invite was claimed. * * @return bool */ public function getIsClaimedAttribute() { return $this->claimed_at !== null; } }