1: <?php
2:
3: namespace App;
4:
5: use Illuminate\Auth\Authenticatable;
6: use Illuminate\Database\Eloquent\Model;
7: use Illuminate\Auth\Passwords\CanResetPassword;
8: use Illuminate\Foundation\Auth\Access\Authorizable;
9: use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
10: use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
11: use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
12: use DB;
13:
14: class User extends Model implements AuthenticatableContract,
15: AuthorizableContract,
16: CanResetPasswordContract
17: {
18: use Authenticatable, Authorizable, CanResetPassword;
19:
20: 21: 22: 23: 24:
25: protected $table = 'user';
26:
27: 28: 29: 30: 31:
32: protected $fillable = [
33: 'email',
34: 'password',
35: 'firstname',
36: 'surname',
37: 'lastname',
38: 'profile_photo',
39: 'phone_number',
40: 'user_rank',
41: 'tablet_name',
42: 'sex'
43: ];
44:
45: 46: 47: 48: 49:
50: protected $hidden = ['password', 'remember_token'];
51:
52: public function driver(){
53: return $this->hasOne('App\Driver');
54: }
55: public function tablet(){
56: return $this->hasOne('App\Tablet');
57: }
58:
59: public static function uploadPicture($id, $img)
60: {
61: DB::table('user')
62: ->where('id', $id)
63: ->update(['profile_photo' => $img]);
64: }
65: }
66: