Commit ee880740 authored by Abraão Barbosa's avatar Abraão Barbosa
Browse files

merge

parent fbaa1a02
......@@ -6,6 +6,32 @@ use Illuminate\Database\Eloquent\Model;
class Unidade extends Model
{
/**
* References table unidade
*
* @var string
*/
protected $table = "unidade";
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name'];
/**
* @return string
*/
public function __toString()
{
return $this->name;
}
const ARCOVERDE = 1;
const CARUARU = 2;
const GARANHUNS = 3;
......@@ -33,9 +59,9 @@ class Unidade extends Model
self::RECIFE => 'Recife',
self::REGIAO_METROPOLITANA => 'Região Metropolitana',
self::SALGUEIRO => 'Salgueiro',
self::SERRA_TALHADA => 'Serra Talhada',
self::SERRA_TALHADA => 'Serra Talhada',
];
return $value != null? $values[$value] : $values;
return $value != null ? $values[$value] : $values;
}
}
......@@ -22,7 +22,8 @@ class CreateUsersTable extends Migration
$table->string('password');
$table->string('document');
$table->tinyInteger('status');
$table->tinyInteger('unidade');
$table->foreignId('curso_id')->nullable();
$table->foreignId('unidade_id')->nullable();
$table->rememberToken();
$table->timestamps();
});
......
......@@ -16,7 +16,7 @@ class CreateCampusTable extends Migration
Schema::create('campus', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->tinyInteger('unidade');
$table->foreignId('unidade_id');
$table->timestamps();
});
}
......
......@@ -13,9 +13,9 @@ class CreateCursoInUsersTable extends Migration
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->foreignId('curso_id');
});
// Schema::table('users', function (Blueprint $table) {
// $table->foreignId('curso_id')->nullable();
// });
}
/**
......@@ -25,8 +25,8 @@ class CreateCursoInUsersTable extends Migration
*/
public function down()
{
if(Schema::hasColumn('users', 'curso_id')) {
Schema::dropColumns('users', ['curso_id']);
}
// if(Schema::hasColumn('users', 'curso_id')) {
// Schema::dropColumns('users', ['curso_id']);
// }
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('unidade', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('unidade');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUnidadeInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::create('users', function (Blueprint $table) {
// $table->foreignId('unidade_id')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// if(Schema::hasColumn('users', 'unidade_id')) {
// Schema::dropColumns('users', ['unidade_id']);
// }
}
}
Markdown is supported
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