Issues (17)

src/Models/Traits/HasApiApps.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Yansongda\LaravelApi\Models\Traits;
4
5
use Yansongda\LaravelApi\Models\AccessToken;
6
use Yansongda\LaravelApi\Models\App;
7
8
trait HasApiApps
9
{
10
    /**
11
     * Get all of the user's registered apps.
12
     *
13
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
14
     */
15
    public function apps()
16
    {
17
        return $this->hasMany(App::class, 'user_id');
0 ignored issues
show
It seems like hasMany() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        return $this->/** @scrutinizer ignore-call */ hasMany(App::class, 'user_id');
Loading history...
18
    }
19
20
    /**
21
     * Get all of the access tokens for the user.
22
     *
23
     * @return \Illuminate\Database\Eloquent\Collection
24
     */
25
    public function tokens()
26
    {
27
        return $this->hasMany(AccessToken::class, 'user_id');
28
    }
29
}
30