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
submeta
Commits
acb4245a
"resources/views/git@sites.upe.br:walter.felipe/submeta.git" did not exist on "335c8815e04c027688f04cf254271ef07c96badb"
Commit
acb4245a
authored
May 19, 2022
by
Guilherme Silva
Browse files
Criação de area tematica
parent
6ebd30af
Changes
4
Show whitespace changes
Inline
Side-by-side
app/AreaTematica.php
0 → 100644
View file @
acb4245a
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
AreaTematica
extends
Model
{
protected
$fillable
=
[
'nome'
,
];
public
function
trabalho
(){
return
$this
->
hasMany
(
'App\Trabalho'
,
'area_tematica_id'
);
}
}
app/Trabalho.php
View file @
acb4245a
...
@@ -38,6 +38,7 @@ class Trabalho extends Model
...
@@ -38,6 +38,7 @@ class Trabalho extends Model
'coordenador_id'
,
'coordenador_id'
,
'proponente_id'
,
'proponente_id'
,
'pivot'
,
'pivot'
,
'area_tematica_id'
,
];
];
...
@@ -64,6 +65,10 @@ class Trabalho extends Model
...
@@ -64,6 +65,10 @@ class Trabalho extends Model
return
$this
->
belongsTo
(
'App\SubArea'
);
return
$this
->
belongsTo
(
'App\SubArea'
);
}
}
public
function
areaTematica
(){
return
$this
->
belongsTo
(
'App\AreaTematica'
);
}
public
function
autor
(){
public
function
autor
(){
return
$this
->
belongsTo
(
'App\User'
,
'autorId'
);
return
$this
->
belongsTo
(
'App\User'
,
'autorId'
);
}
}
...
...
database/migrations/2022_05_18_055323_create_area_tematicas_table.php
0 → 100644
View file @
acb4245a
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateAreaTematicasTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'area_tematicas'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'nome'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'area_tematicas'
);
}
}
database/migrations/2022_05_18_055612_add_area_tematica_to_trabalhos_table.php
0 → 100644
View file @
acb4245a
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddAreaTematicaToTrabalhosTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
$table
->
integer
(
'area_tematica_id'
)
->
nullable
();
$table
->
foreign
(
'area_tematica_id'
)
->
references
(
'id'
)
->
on
(
'area_tematicas'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
//
});
}
}
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