1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use \Illuminate\Support\Facades\Schema;
use Jenssegers\Eloquent\Model as Eloquent;
class MysqlRole extends Eloquent {
protected $connection = 'mysql';
protected $table = 'roles';
protected static $unguarded = true;
public function user()
{
return $this->belongsTo('User');
}
public function mysqlUser()
{
return $this->belongsTo('MysqlUser');
}
/**
* Check if we need to run the schema
* @return [type] [description]
*/
public static function executeSchema()
{
$schema = Schema::connection('mysql');
if (!$schema->hasTable('roles'))
{
Schema::connection('mysql')->create('roles', function($table)
{
$table->string('type');
$table->string('user_id');
$table->timestamps();
});
}
}
}