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
fd820c2c
"app/vscode:/vscode.git/clone" did not exist on "ae1b0fb30d14811e17ea351673c61230aa1d081b"
Commit
fd820c2c
authored
Mar 21, 2022
by
Jose Fernando Mendes da Costa
Browse files
Cria models para solicitacao de certificado
parent
8060f9e6
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/Notificacao.php
100644 → 100755
View file @
fd820c2c
...
@@ -12,7 +12,7 @@ class Notificacao extends Model
...
@@ -12,7 +12,7 @@ class Notificacao extends Model
* @var array
* @var array
*/
*/
protected
$fillable
=
[
protected
$fillable
=
[
'lido'
,
'tipo'
,
'destinatario_id'
,
'remetente_id'
,
'perfil_id'
,
'trabalho_id'
,
'lido'
,
'tipo'
,
'destinatario_id'
,
'remetente_id'
,
'perfil_id'
,
'trabalho_id'
,
'solicitacao_certificado_id'
,
];
];
public
function
destinatario
(){
public
function
destinatario
(){
...
@@ -26,4 +26,9 @@ class Notificacao extends Model
...
@@ -26,4 +26,9 @@ class Notificacao extends Model
public
function
trabalho
(){
public
function
trabalho
(){
return
$this
->
belongsTo
(
Trabalho
::
class
,
'trabalho_id'
,
'id'
);
return
$this
->
belongsTo
(
Trabalho
::
class
,
'trabalho_id'
,
'id'
);
}
}
public
function
solicitacaoCertificado
()
{
return
$this
->
belongsTo
(
'\App\SolicitacaoCertificado'
,
'solicitacao_certificado_id'
);
}
}
}
app/SolicitacaoCertificado.php
0 → 100755
View file @
fd820c2c
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
SolicitacaoCertificado
extends
Model
{
protected
$table
=
"solicitacoes_certificados"
;
protected
$fillable
=
[
'trabalho_id'
];
public
function
solicitacoesParticipantes
()
{
return
$this
->
hasMany
(
'App\SolicitacaoParticipante'
,
'solicitacao_certificado_id'
);
}
}
app/SolicitacaoParticipante.php
0 → 100644
View file @
fd820c2c
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
SolicitacaoParticipante
extends
Model
{
protected
$table
=
"solicitacoes_participantes"
;
protected
$fillable
=
[
'solicitacao_certificado_id'
,
'user_id'
];
public
function
solicitacaoCertificado
()
{
return
$this
->
belongsTo
(
'App\SolicitacaoCertificado'
,
'solicitacao_certificado_id'
);
}
public
function
user
()
{
return
$this
->
belongsTo
(
'App\User'
,
'user_id'
);
}
}
app/Trabalho.php
View file @
fd820c2c
...
@@ -110,4 +110,9 @@ class Trabalho extends Model
...
@@ -110,4 +110,9 @@ class Trabalho extends Model
public
function
notificacoes
(){
public
function
notificacoes
(){
return
$this
->
hasMany
(
Notificacao
::
class
,
'trabalho_id'
,
'id'
);
return
$this
->
hasMany
(
Notificacao
::
class
,
'trabalho_id'
,
'id'
);
}
}
public
function
solicitacoesCertificados
()
{
return
$this
->
hasMany
(
Certificado
::
class
,
'trabalho_id'
);
}
}
}
database/migrations/2022_03_18_083809_create_certificados_table.php
0 → 100755
View file @
fd820c2c
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateCertificadosTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'solicitacoes_certificados'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'solicitacoes_certificados'
);
}
}
database/migrations/2022_03_21_122553_create_solicitacao_participantes_table.php
0 → 100644
View file @
fd820c2c
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateSolicitacaoParticipantesTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'solicitacoes_participantes'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
$table
->
unsignedBigInteger
(
'solicitacao_certificado_id'
);
$table
->
foreign
(
'solicitacao_certificado_id'
)
->
references
(
'id'
)
->
on
(
'solicitacoes_certificados'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'solicitacoes_participantes'
);
}
}
database/migrations/2022_03_21_123012_add_solicitacao_certificado_to_notificacaos.php
0 → 100644
View file @
fd820c2c
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddSolicitacaoCertificadoToNotificacaos
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'notificacaos'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'solicitacao_certificado_id'
)
->
nullable
();
$table
->
foreign
(
'solicitacao_certificado_id'
)
->
references
(
'id'
)
->
on
(
'solicitacoes_certificados'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'notificacaos'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
([
'solicitacao_certificado_id'
]);
$table
->
dropColumn
(
'solicitacao_certificado_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