Skip to content

Commit 6a2c6d8

Browse files
Remove migrations
1 parent 5a6bb82 commit 6a2c6d8

File tree

7 files changed

+1055
-24
lines changed

7 files changed

+1055
-24
lines changed

app/Models/User.php

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22

33
namespace App\Models;
44

5-
// use Illuminate\Contracts\Auth\MustVerifyEmail;
5+
use Illuminate\Database\Eloquent\Casts\Attribute;
66
use Illuminate\Database\Eloquent\Factories\HasFactory;
77
use Illuminate\Foundation\Auth\User as Authenticatable;
88
use Illuminate\Notifications\Notifiable;
9+
use JoelButcher\Socialstream\HasConnectedAccounts;
10+
use JoelButcher\Socialstream\SetsProfilePhotoFromUrl;
11+
use Laravel\Fortify\TwoFactorAuthenticatable;
12+
use Laravel\Jetstream\HasProfilePhoto;
913
use Laravel\Sanctum\HasApiTokens;
1014

1115
class User extends Authenticatable
1216
{
13-
use HasApiTokens, HasFactory, Notifiable;
17+
use HasApiTokens;
18+
use HasConnectedAccounts;
19+
use HasFactory;
20+
use HasProfilePhoto {
21+
HasProfilePhoto::profilePhotoUrl as getPhotoUrl;
22+
}
23+
use Notifiable;
24+
use SetsProfilePhotoFromUrl;
25+
use TwoFactorAuthenticatable;
1426

1527
/**
1628
* The attributes that are mass assignable.
@@ -24,22 +36,45 @@ class User extends Authenticatable
2436
];
2537

2638
/**
27-
* The attributes that should be hidden for serialization.
39+
* The attributes that should be hidden for arrays.
2840
*
2941
* @var array<int, string>
3042
*/
3143
protected $hidden = [
3244
'password',
3345
'remember_token',
46+
'two_factor_recovery_codes',
47+
'two_factor_secret',
3448
];
3549

3650
/**
37-
* The attributes that should be cast.
51+
* The accessors to append to the model's array form.
3852
*
39-
* @var array<string, string>
53+
* @var array<int, string>
4054
*/
41-
protected $casts = [
42-
'email_verified_at' => 'datetime',
43-
'password' => 'hashed',
55+
protected $appends = [
56+
'profile_photo_url',
4457
];
58+
59+
/**
60+
* Get the attributes that should be cast.
61+
*
62+
* @return array<string, string>
63+
*/
64+
protected function casts(): array
65+
{
66+
return [
67+
'email_verified_at' => 'datetime',
68+
];
69+
}
70+
71+
/**
72+
* Get the URL to the user's profile photo.
73+
*/
74+
public function profilePhotoUrl(): Attribute
75+
{
76+
return filter_var($this->profile_photo_path, FILTER_VALIDATE_URL)
77+
? Attribute::get(fn () => $this->profile_photo_path)
78+
: $this->getPhotoUrl();
79+
}
4580
}

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
"php": "^8.3",
1212
"filament/filament": "^3.2",
1313
"guzzlehttp/guzzle": "^7.8",
14+
"joelbutcher/socialstream": "^6.0",
1415
"laravel/framework": "^11.0",
16+
"laravel/jetstream": "^5.1",
1517
"laravel/sanctum": "^4.0",
1618
"laravel/tinker": "^2.9",
17-
"livewire/livewire": "^3.5"
19+
"livewire/livewire": "^3.5",
20+
"stephenjude/filament-jetstream": "^0.0.11"
1821
},
1922
"require-dev": {
2023
"fakerphp/faker": "^1.23",

0 commit comments

Comments
 (0)