GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — rewrite-laravel ( 96dff9...f203d9 )
by Oliver
11:47
created

Transaction::getDateAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
8
9
class Transaction extends Model
10
{
11
    use SoftDeletes;
12
    use HasMediaTrait;
13
14
    protected $fillable = ['account_name', 'to_account_name', 'payee_name', 'category_name', 'sub_category_name', 'amount', 'notes'];
15
16
    /**
17
     * The attributes that should be mutated to dates.
18
     *
19
     * @var array
20
     */
21
    protected $dates = ['deleted_at'];
22
23
    public function getDateAttribute()
24
    {
25
        return $this->created_at->toDateString();
0 ignored issues
show
Documentation introduced by
The property created_at does not exist on object<App\Models\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
26
    }
27
28
    public function status()
29
    {
30
        return $this->belongsTo(TransactionStatus::class);
31
    }
32
33
    public function type()
34
    {
35
        return $this->belongsTo(TransactionType::class);
36
    }
37
}
38