Updated logo API
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use App\Http\Controllers\UserFlightController;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||
@@ -32,6 +33,16 @@ class User extends Authenticatable
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRouteBinding($value, $field = null): ?User
|
||||
{
|
||||
return $this->where('name', 'ilike', $value)->firstOrFail();
|
||||
}
|
||||
|
||||
public function FlightController(): UserFlightController
|
||||
{
|
||||
return new UserFlightController($this);
|
||||
}
|
||||
|
||||
public function flights(): HasMany {
|
||||
return $this->hasMany(UserFlight::class);
|
||||
}
|
||||
@@ -40,4 +51,19 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany(ImportedFlight::class);
|
||||
}
|
||||
|
||||
public function following(): HasMany
|
||||
{
|
||||
return $this->hasMany(Followee::class, 'user_id');
|
||||
}
|
||||
|
||||
public function followers(): HasMany
|
||||
{
|
||||
return $this->hasMany(Followee::class, 'followee_id');
|
||||
}
|
||||
|
||||
public function isFollowing(User $user): bool
|
||||
{
|
||||
return $this->following()->where('followee_id', $user->id)->exists();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user