Skip to content

Commit

Permalink
adding relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek J. Augustine committed May 28, 2016
1 parent 6d07edd commit 3df4c6e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property-read \App\User $user
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Claim[] $claims
* @method static \Illuminate\Database\Query\Builder|\App\Cache whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Cache whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Cache whereCode($value)
Expand All @@ -40,4 +42,20 @@ class Cache extends Model
* @var array
*/
protected $dates = ['deleted_at'];

/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}

/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function claims()
{
return $this->hasMany(Claim::class);
}
}
9 changes: 9 additions & 0 deletions app/Claim.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $hidden_at
* @property \Carbon\Carbon $deleted_at
* @property-read \App\Cache $cache
* @method static \Illuminate\Database\Query\Builder|\App\Claim whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Claim whereCacheId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Claim whereEmail($value)
Expand All @@ -40,4 +41,12 @@ class Claim extends Model
* @var array
*/
protected $dates = ['hidden_at', 'deleted_at'];

/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function cache()
{
return $this->belongsTo(Cache::class);
}
}
9 changes: 9 additions & 0 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $online_at
* @property \Carbon\Carbon $deleted_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Cache[] $caches
* @method static \Illuminate\Database\Query\Builder|\App\User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\User whereFirstName($value)
* @method static \Illuminate\Database\Query\Builder|\App\User whereMiddleName($value)
Expand Down Expand Up @@ -61,6 +62,14 @@ class User extends Model implements Authenticatable, CanResetPassword
'password', 'remember_token',
];

/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function caches()
{
return $this->hasMany(Cache::class);
}

/**
* Get the name of the unique identifier for the user.
*
Expand Down

0 comments on commit 3df4c6e

Please sign in to comment.