Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
pad-upe
Commits
ee880740
Commit
ee880740
authored
Mar 13, 2022
by
Abraão Barbosa
Browse files
merge
parent
fbaa1a02
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/Models/Unidade.php
View file @
ee880740
...
...
@@ -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
;
}
}
database/migrations/2014_10_12_000000_create_users_table.php
View file @
ee880740
...
...
@@ -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
();
});
...
...
database/migrations/2022_02_02_014208_create_campus_table.php
View file @
ee880740
...
...
@@ -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
();
});
}
...
...
database/migrations/2022_02_02_014728_create_curso_in_users_table.php
View file @
ee880740
...
...
@@ -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']);
//
}
}
}
database/migrations/2022_02_09_182043_create_unidade_table.php
0 → 100644
View file @
ee880740
<?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'
);
}
}
database/migrations/2022_03_11_131811_create_unidade_in_users_table.php
0 → 100644
View file @
ee880740
<?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']);
// }
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment