-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParents.php
55 lines (45 loc) · 933 Bytes
/
Parents.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Parents extends Authenticatable
{
use Notifiable;
/**
* mass assignment
* @var array
*/
protected $fillable =
[
'name',
'user_name',
'work_place',
'email',
'position',
'date_of_birth',
'payment_type_id',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = ['password'];
/**
* parent has many children
*/
public function children()
{
return $this->hasMany('App\Child', 'parents_id');
}
/**
* get parent id from the email.
* @param $email
* @return string
*/
public static function getIdFromEmail($email)
{
return static::where('email', $email)->first()->id;
}
}