Created
October 28, 2016 01:09
-
-
Save d3v2a/967e9bd51282fe27dbbcb421eddb5b41 to your computer and use it in GitHub Desktop.
bug with phpunit
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 FirstModel extends Model | |
{ | |
protected $table = 'FirstModels'; | |
public $timestamps = false; | |
protected $connection = 'db1'; | |
} |
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 SecondModel extends Model | |
{ | |
public function firstModels() | |
{ | |
$defaultDb = config('database.default'); | |
$db = config('database.connections.' . $defaultDb . '.database'); | |
return $relation = $this->belongsToMany( | |
\App\FirstModel::class, | |
$db . '.secound_model_First_model', | |
'second_model_id', | |
'first_model_id' | |
)->withPivot('type'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment