Skip to content
Snippets Groups Projects
Commit dfc437f7 authored by gazandi's avatar gazandi
Browse files
parents 886505ec 9be4e7f0
Branches
No related merge requests found
Pipeline #1193 skipped
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
| |
*/ */
Route::get('/', function () {
return view('welcome');
});
Route::group(['middleware' => 'web'], function () { Route::group(['middleware' => 'web'], function () {
Route::auth(); Route::auth();
......
...@@ -4,10 +4,10 @@ namespace App; ...@@ -4,10 +4,10 @@ namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Permission extends Model class Role extends Model
{ {
public function users() public function users()
{ {
return $this->hasMany('App\User')->withTimestamps(); return $this->hasMany('App\User', 'role_id');
} }
} }
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Schedule extends Model
{
public function users()
{
return $this->belongsTo('App\User');
}
public function tps()
{
return $this->belongsTo('App\Tps');
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Tps extends Model
{
public function schedule()
{
return $this->hasMany('App\Schedule', 'id_tps');
}
}
...@@ -24,8 +24,13 @@ class User extends Authenticatable ...@@ -24,8 +24,13 @@ class User extends Authenticatable
'password', 'remember_token', 'password', 'remember_token',
]; ];
public function permissions() public function roles()
{ {
return $this->belongsToMany('App\Permission')->withTimestamps(); return $this->belongsTo('App\Role');
}
public function schedule()
{
return $this->hasMany('App\Schedule', 'id_user');
} }
} }
...@@ -18,6 +18,7 @@ class CreateUsersTable extends Migration ...@@ -18,6 +18,7 @@ class CreateUsersTable extends Migration
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->string('password'); $table->string('password');
$table->integer('role_id')->unsigned();
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreatePermissionsTable extends Migration class CreateRolesTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
...@@ -12,11 +12,10 @@ class CreatePermissionsTable extends Migration ...@@ -12,11 +12,10 @@ class CreatePermissionsTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('permissions', function(Blueprint $table) Schema::create('roles', function(Blueprint $table)
{ {
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->string('slug')->unique();
$table->text('description')->nullable(); $table->text('description')->nullable();
$table->timestamps(); $table->timestamps();
}); });
...@@ -29,6 +28,6 @@ class CreatePermissionsTable extends Migration ...@@ -29,6 +28,6 @@ class CreatePermissionsTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::drop('permissions'); Schema::drop('roles');
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreatePermissionUserTable extends Migration class CreateTpsTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
...@@ -12,13 +12,14 @@ class CreatePermissionUserTable extends Migration ...@@ -12,13 +12,14 @@ class CreatePermissionUserTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('permission_user', function(Blueprint $table) Schema::create('tps', function(Blueprint $table)
{ {
$table->increments('id'); $table->increments('id');
$table->integer('permission_id'); $table->integer('capacity_now');
$table->integer('user_id'); $table->integer('capacity_full');
$table->integer('manager_id')->unsigned();
$table->timestamps(); $table->timestamps();
}); });
} }
/** /**
...@@ -28,7 +29,6 @@ class CreatePermissionUserTable extends Migration ...@@ -28,7 +29,6 @@ class CreatePermissionUserTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::drop('permission_user'); Schema::drop('tps');
} }
}
}
\ No newline at end of file
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateScheduleTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('schedule', function(Blueprint $table)
{
$table->increments('id');
$table->integer('id_tps')->unsigned();
$table->integer('id_user')->unsigned();
$table->timestamp('time');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('schedule');
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment