Issues (465)

app/Models/User.php (5 issues)

1
<?php
2
3
namespace App\Models;
4
5
use App\Models\Provider;
6
use App\Notifications\ResetPassword as ResetPasswordNotification;
7
use App\Notifications\VerifyNotification;
8
use Illuminate\Contracts\Auth\MustVerifyEmail;
9
use Illuminate\Database\Eloquent\Factories\HasFactory;
10
use Illuminate\Foundation\Auth\User as Authenticatable;
11
use Illuminate\Notifications\Notifiable;
12
use Laravel\Cashier\Billable;
13
use Laravel\Sanctum\HasApiTokens;
14
use Spatie\MediaLibrary\Models\Media;
0 ignored issues
show
The type Spatie\MediaLibrary\Models\Media was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Spatie\Permission\Traits\HasRoles;
16
17
class User extends Authenticatable implements MustVerifyEmail
18
{
19
    use HasFactory, Notifiable, HasApiTokens, Billable, HasRoles;
0 ignored issues
show
The trait Illuminate\Notifications\Notifiable requires the property $email which is not provided by App\Models\User.
Loading history...
The trait Spatie\Permission\Traits\HasRoles requires some properties which are not provided by App\Models\User: $name, $map, $permissions, $roles, $guard_name
Loading history...
The trait Laravel\Cashier\Billable requires some properties which are not provided by App\Models\User: $tax_exempt, $collection_method, $email, $data, $default_source, $brand, $last4, $paid, $customer, $type, $card, $default_payment_method, $payment_intent, $trial_ends_at, $subscriptions
Loading history...
20
21
    /**
22
     * The attributes that are mass assignable.
23
     *
24
     * @var array
25
     */
26
    protected $fillable = [
27
        'first_name',
28
        'last_name',
29
        'email',
30
        'password',
31
        'email_verified_at'
32
    ];
33
    protected $connection = 'landlord';
34
35
    public function sendPasswordResetNotification($token)
36
    {
37
        // Your your own implementation.
38
        $this->notify(new ResetPasswordNotification($token));
39
    }
40
41
    /**
42
     * The attributes that should be hidden for arrays.
43
     *
44
     * @var array
45
     */
46
    protected $hidden = [
47
        'password',
48
        'remember_token',
49
    ];
50
51
    /**
52
     * The attributes that should be cast to native types.
53
     *
54
     * @var array
55
     */
56
    protected $casts = [
57
        'email_verified_at' => 'datetime',
58
    ];
59
60
    public function providers()
61
    {
62
        return $this->hasMany(Provider::class, 'user_id', 'id');
63
    }
64
65
    public function userStartedChats()
66
    {
67
        return $this->hasMany(Chat::class, 'user_1')->join('users as partner', 'user_2', '=', 'partner.id');
68
    }
69
70
    public function userNotStartedChats()
71
    {
72
        return $this->hasMany(Chat::class, 'user_2')->join('users as partner', 'user_1', '=', 'partner.id');
73
    }
74
75
    public function userChats()
76
    {
77
        return $this->userStartedChats->merge($this->userNotStartedChats);
78
    }
79
80
    public function Company()
81
    {
82
        return $this->belongsToMany(Company::class, 'user_company');
83
    }
84
85
    public function sendEmailVerificationNotification()
86
    {
87
        return $this->notify(new VerifyNotification());
0 ignored issues
show
Are you sure the usage of $this->notify(new App\No...s\VerifyNotification()) targeting App\Models\User::notify() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
88
    }
89
}
90