Skip to content

Instantly share code, notes, and snippets.

@wichaksono
Created March 15, 2018 00:53
Show Gist options
  • Save wichaksono/24c46597d470c1e8794eceb87cb0dbf8 to your computer and use it in GitHub Desktop.
Save wichaksono/24c46597d470c1e8794eceb87cb0dbf8 to your computer and use it in GitHub Desktop.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
public $timestamps = false;
protected $fillable = [
'role_name', 'created_at', 'updated_at'
];
/*
* Method untuk yang mendefinisikan relasi antara model user dan model Role
*/
public function getUserObject()
{
return $this->belongsToMany(User::class)->using(UserRole::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment