Enrollment::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Magister\Models\Enrollment;
4
5
use Config;
6
use DateTime;
7
use Magister\Services\Database\Elegant\Model;
8
9
/**
10
 * Class Enrollment.
11
 */
12 View Code Duplication
class Enrollment extends Model
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * The attributes that should be mutated to dates.
16
     *
17
     * @var array
18
     */
19
    protected $dates = ['Start', 'Einde'];
20
21
    /**
22
     * Get the url associated with the model.
23
     *
24
     * @return string
25
     */
26
    public function getUrl()
27
    {
28
        return Config::get('url.enrollment');
29
    }
30
31
    /**
32
     * Grab the current enrollment from the collection.
33
     *
34
     * @return mixed
35
     */
36
    public static function current()
37
    {
38
        $today = (new DateTime())->format('Y-m-d');
39
40
        return static::where('geenToekomstige', false)->where('peildatum', $today)->first();
41
    }
42
43
    /**
44
     * Define a relationship.
45
     *
46
     * @return mixed
47
     */
48
    public function counsellors()
49
    {
50
        return $this->hasMany('Magister\Models\Enrollment\Counsellor', 'group', 'Groep.Id');
51
    }
52
}
53