Issues (350)

app/Models/Partner.php (2 issues)

Severity
1
<?php
2
3
namespace App\Models;
4
5
use Backpack\CRUD\app\Models\Traits\CrudTrait;
6
use Carbon\Carbon;
7
use Illuminate\Database\Eloquent\Factories\HasFactory;
8
use Illuminate\Database\Eloquent\Model;
9
10
/**
11
 * @mixin IdeHelperPartner
12
 */
13
class Partner extends Model
14
{
15
    use CrudTrait;
0 ignored issues
show
The trait Backpack\CRUD\app\Models\Traits\CrudTrait requires some properties which are not provided by App\Models\Partner: $fakeColumns, $identifiableAttribute, $Type
Loading history...
16
    use HasFactory;
17
18
    protected $guarded = ['id'];
19
20
    public function courses()
21
    {
22
        return $this->hasMany(Course::class);
23
    }
24
25
    public function getFormattedStartDateAttribute()
26
    {
27
        if (! $this->started_on) {
28
            return '-';
29
        }
30
31
        return Carbon::parse($this->started_on)->locale(app()->getLocale())->isoFormat('Do MMM YYYY');
0 ignored issues
show
The method getLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

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

31
        return Carbon::parse($this->started_on)->locale(app()->/** @scrutinizer ignore-call */ getLocale())->isoFormat('Do MMM YYYY');
Loading history...
32
    }
33
34
    public function getFormattedEndDateAttribute()
35
    {
36
        if (! $this->expired_on) {
37
            return '-';
38
        }
39
40
        return Carbon::parse($this->expired_on)->locale(app()->getLocale())->isoFormat('Do MMM YYYY');
41
    }
42
}
43