Skip to content

Instantly share code, notes, and snippets.

@w00p
Created April 2, 2017 16:36
Show Gist options
  • Select an option

  • Save w00p/c6e599a46fa42bdfdfc9a4d147a58ed0 to your computer and use it in GitHub Desktop.

Select an option

Save w00p/c6e599a46fa42bdfdfc9a4d147a58ed0 to your computer and use it in GitHub Desktop.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Activity extends Model
{
protected $fillable = [
'subject_id',
'subject_type',
'user_id',
'name',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function subject()
{
return $this->morphTo()->withTrashed();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment