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 | |
Schema::create('users', function (Blueprint $table) { | |
$table->increments('id'); | |
$table->string('name'); | |
$table->string('email')->unique(); | |
$table->string('password'); | |
$table->rememberToken(); | |
$table->timestamps(); | |
}); |
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 | |
Schema::create('posts', function (Blueprint $table) { | |
$table->increments('id'); | |
$table->unsignedInteger('user_id'); | |
$table->string('name'); | |
$table->text('body'); | |
$table->timestamps(); | |
}); |
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 | |
Route::domain('{customer}.multi-tenancy.job')->prefix('api/v1')->group(function () { | |
Route::get('users', function ($customer) { | |
return App\Customer\Models\User::all(); | |
}); | |
}); |
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
Route::domain('{customer}.multi-tenancy.job')->prefix('api/v1')->group(function () { | |
Route::get('users', function ($customer) { | |
return App\Customer\Models\User::all(); | |
}); | |
}); |
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\Shared\Models; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
use Illuminate\Notifications\Notifiable; | |
class User extends Authenticatable | |
{ | |
use Notifiable; |
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\System\Models; | |
use App\Shared\Models\User as Shared; | |
use Hyn\Tenancy\Traits\UsesSystemConnection; | |
class User extends Shared | |
{ | |
use UsesSystemConnection; |
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\Customer\Models; | |
use App\Shared\Models\User as Shared; | |
use Hyn\Tenancy\Traits\UsesTenantConnection; | |
class User extends Shared | |
{ | |
use UsesTenantConnection; |
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\Customer\Models; | |
use Hyn\Tenancy\Traits\UsesTenantConnection; | |
use Illuminate\Database\Eloquent\Model; | |
class Post extends Model | |
{ | |
use UsesTenantConnection; |
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
DB_CONNECTION=system | |
DB_HOST=127.0.0.1 | |
DB_PORT=3306 | |
DB_DATABASE=system_tenancy | |
DB_USERNAME=root | |
DB_PASSWORD= | |
LIMIT_UUID_LENGTH_32=true | |
TENANCY_DATABASE_AUTO_DELETE=true | |
TENANCY_DATABASE_AUTO_DELETE_USER=true |
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 | |
use App\Customer\Models\User; | |
use Hyn\Tenancy\Models\Customer; | |
Route::get('customers', function () { | |
return Customer::all(); | |
}); | |
Route::get('users', function () { |