Skip to content

Instantly share code, notes, and snippets.

@tiagoandrepro
Created July 9, 2018 04:41
Show Gist options
  • Save tiagoandrepro/c3cb09986c87aa267710bfd6dfc7b394 to your computer and use it in GitHub Desktop.
Save tiagoandrepro/c3cb09986c87aa267710bfd6dfc7b394 to your computer and use it in GitHub Desktop.
Treinamento
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Course extends Model
{
public $table = 'courses';
public function user()
{
return $this->belongsToMany('App\User');
}
public function order()
{
return $this->belongsToMany(Order::class);
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
public function user()
{
return $this->belongsTo('App\User');
}
public function course()
{
return $this->belongsToMany(Course::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment