Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
Commit
acb4245a
authored
3 years ago
by
Guilherme Silva
Browse files
Options
Download
Email Patches
Plain Diff
Criação de area tematica
parent
6ebd30af
master
carl-branch
dependabot/composer/dompdf/dompdf-1.2.2
dependabot/composer/guzzlehttp/guzzle-6.5.8
dependabot/composer/symfony/http-kernel-4.4.50
dependabot/npm_and_yarn/decode-uri-component-0.2.2
dependabot/npm_and_yarn/express-4.18.2
dependabot/npm_and_yarn/json5-and-json5-2.2.3
dependabot/npm_and_yarn/loader-utils-and-webpack-cli-1.4.2
dependabot/npm_and_yarn/minimist-and-mkdirp-1.2.8
dependabot/npm_and_yarn/qs-and-express-6.11.0
excluir_projeto_submetido
updates_mar
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/AreaTematica.php
+17
-0
app/AreaTematica.php
app/Trabalho.php
+5
-0
app/Trabalho.php
database/migrations/2022_05_18_055323_create_area_tematicas_table.php
+33
-0
...rations/2022_05_18_055323_create_area_tematicas_table.php
database/migrations/2022_05_18_055612_add_area_tematica_to_trabalhos_table.php
+33
-0
...022_05_18_055612_add_area_tematica_to_trabalhos_table.php
with
88 additions
and
0 deletions
+88
-0
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'
);
}
}
This diff is collapsed.
Click to expand it.
app/Trabalho.php
View file @
acb4245a
...
...
@@ -38,6 +38,7 @@ class Trabalho extends Model
'coordenador_id'
,
'proponente_id'
,
'pivot'
,
'area_tematica_id'
,
];
...
...
@@ -64,6 +65,10 @@ class Trabalho extends Model
return
$this
->
belongsTo
(
'App\SubArea'
);
}
public
function
areaTematica
(){
return
$this
->
belongsTo
(
'App\AreaTematica'
);
}
public
function
autor
(){
return
$this
->
belongsTo
(
'App\User'
,
'autorId'
);
}
...
...
This diff is collapsed.
Click to expand it.
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'
);
}
}
This diff is collapsed.
Click to expand it.
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
)
{
//
});
}
}
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help