Skip to content

Instantly share code, notes, and snippets.

View jyhsu2000's full-sized avatar

KID jyhsu2000

View GitHub Profile
@jyhsu2000
jyhsu2000 / pivot_example.php
Created January 24, 2019 10:07 — forked from lighta971/pivot_example.php
Laravel Custom Pivot Model definition example
<?php
//https://github.com/laravel/framework/issues/2093#issuecomment-39154456
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\Relations\Pivot;
class User extends Eloquent {
public function groups() {
return $this->belongsToMany('Group');