-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathGoogleClassroom.php
65 lines (57 loc) · 1.41 KB
/
GoogleClassroom.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
56
57
58
59
60
61
62
63
64
65
<?php
namespace App\Models;
use App\User;
use Illuminate\Database\Eloquent\Model;
class GoogleClassroom extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'gclass_api_data';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'course_id',
'name',
'section',
'description_heading',
'description',
'room',
'owner_id',
'enrollment_code',
'course_state',
'alternate_link',
'teacher_group_email',
'course_group_email',
'guardians_enabled',
'calendar_id',
'curriki_teacher_email',
'curriki_teacher_org'
];
/**
* Cascade on delete the user
*/
public static function boot()
{
parent::boot();
self::retrieved(function (GoogleClassroom $gclassData) {
$gclassData->curriki_teacher_email = strtolower($gclassData->curriki_teacher_email);
});
self::creating(function(GoogleClassroom $gclassData) {
$gclassData->curriki_teacher_email = strtolower($gclassData->curriki_teacher_email);
});
}
/**
* Get the user_id for the teacher
*/
public function publisherUser()
{
return $this->hasOne(User::class, 'email' , 'curriki_teacher_email');
}
}