Created
February 8, 2017 12:25
-
-
Save WendellAdriel/e9a015d43f8c6748ac1c2fc19257f930 to your computer and use it in GitHub Desktop.
Simple many-to-many laravel 5 example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Client extends Model | |
{ | |
public function tickets() | |
{ | |
return $this->belongsToMany('App\Ticket', 'clients_tickets'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Ticket extends Model | |
{ | |
public function clients() | |
{ | |
return $this->belongsToMany('App\Client', 'clients_tickets'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment