Issues (166)

app/Plan.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App;
4
5
use Lubus\Constants\Status;
0 ignored issues
show
The type Lubus\Constants\Status 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...
6
use Sofa\Eloquence\Eloquence;
7
use Illuminate\Database\Eloquent\Model;
8
9
class Plan extends Model
10
{
11
    protected $table = 'mst_plans';
12
13
    protected $fillable = [
14
    		'plan_code',
15
            'plan_name',
16
    		'service_id',
17
    		'plan_details',
18
    		'days',
19
    		'amount',
20
    		'status',
21
    		'created_by',
22
    		'updated_by'
23
    ];
24
25
    //Eloquence Search mapping
26
    use Eloquence;
27
28
    protected $searchableColumns = [
29
        'plan_code' => 20,
30
        'plan_name' => 10,
31
        'plan_details' => 5,
32
    ];
33
34
    public function getPlanDisplayAttribute() 
35
    { 
36
        return $this->plan_code . ' @ ' . $this->amount .' For '. $this->days .' Days'; 
37
    }
38
39
    public function scopeExcludeArchive($query)
40
    {
41
       return $query->where('status','!=', \constStatus::Archive);
42
    }
43
44
    public function scopeOnlyActive($query)
45
    {
46
        return $query->where('status','=', \constStatus::Active);
47
    }
48
49
    public function createdBy()
50
    {
51
        return $this->belongsTo('App\User','created_by');
52
    }
53
54
    public function updatedBy()
55
    {
56
        return $this->belongsTo('App\User','updated_by');
57
    }
58
59
    public function Subscriptions()
60
    {
61
        return $this->hasMany('App\Subscription','plan_id');
62
    }
63
64
    public function Service()
65
    {
66
        return $this->belongsTo('App\Service','service_id');
67
    }
68
}
69