Skip to content

Commit

Permalink
Remove migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisdelicata committed Jun 13, 2024
1 parent a7a044a commit 9623095
Show file tree
Hide file tree
Showing 7 changed files with 1,055 additions and 24 deletions.
51 changes: 43 additions & 8 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use JoelButcher\Socialstream\HasConnectedAccounts;
use JoelButcher\Socialstream\SetsProfilePhotoFromUrl;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
use HasApiTokens;
use HasConnectedAccounts;
use HasFactory;
use HasProfilePhoto {
HasProfilePhoto::profilePhotoUrl as getPhotoUrl;
}
use Notifiable;
use SetsProfilePhotoFromUrl;
use TwoFactorAuthenticatable;

/**
* The attributes that are mass assignable.
Expand All @@ -24,22 +36,45 @@ class User extends Authenticatable
];

/**
* The attributes that should be hidden for serialization.
* The attributes that should be hidden for arrays.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
'two_factor_recovery_codes',
'two_factor_secret',
];

/**
* The attributes that should be cast.
* The accessors to append to the model's array form.
*
* @var array<string, string>
* @var array<int, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
protected $appends = [
'profile_photo_url',
];

/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
];
}

/**
* Get the URL to the user's profile photo.
*/
public function profilePhotoUrl(): Attribute
{
return filter_var($this->profile_photo_path, FILTER_VALIDATE_URL)
? Attribute::get(fn () => $this->profile_photo_path)
: $this->getPhotoUrl();
}
}
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
"php": "^8.3",
"filament/filament": "^3.2",
"guzzlehttp/guzzle": "^7.8",
"joelbutcher/socialstream": "^6.0",
"laravel/framework": "^11.0",
"laravel/jetstream": "^5.1",
"laravel/octane": "^2.3",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5"
"livewire/livewire": "^3.5",
"stephenjude/filament-jetstream": "^0.0.11"
},
"require-dev": {
"fakerphp/faker": "^1.23",
Expand Down
Loading

0 comments on commit 9623095

Please sign in to comment.