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
545187d1
Commit
545187d1
authored
3 years ago
by
Guilherme Silva
Browse files
Options
Download
Email Patches
Plain Diff
Adicionado notificação ao sistema
parent
e413fe86
master
carl-branch
dependabot/composer/dompdf/dompdf-1.2.2
dependabot/composer/guzzlehttp/guzzle-6.5.8
dependabot/composer/guzzlehttp/psr7-1.8.5
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
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Http/Controllers/NotificacaoController.php
+99
-0
app/Http/Controllers/NotificacaoController.php
app/Notificacao.php
+29
-0
app/Notificacao.php
database/migrations/2022_01_24_222743_create_notificacaos_table.php
+42
-0
...igrations/2022_01_24_222743_create_notificacaos_table.php
with
170 additions
and
0 deletions
+170
-0
app/Http/Controllers/NotificacaoController.php
0 → 100644
View file @
545187d1
<?php
namespace
App\Http\Controllers
;
use
App\Notificacao
;
use
Illuminate\Http\Request
;
class
NotificacaoController
extends
Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public
function
index
()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public
function
create
()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public
function
store
(
Request
$request
)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Notificacao $notificacao
* @return \Illuminate\Http\Response
*/
public
function
show
(
Notificacao
$notificacao
)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Notificacao $notificacao
* @return \Illuminate\Http\Response
*/
public
function
edit
(
Notificacao
$notificacao
)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Notificacao $notificacao
* @return \Illuminate\Http\Response
*/
public
function
update
(
Request
$request
,
Notificacao
$notificacao
)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Notificacao $notificacao
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
Notificacao
$notificacao
)
{
//
}
public
function
listar
()
{
$notificacoes
=
Notificacao
::
all
()
->
sortBy
(
'created_at'
);
return
view
(
'notificacao.listar'
,[
'notificacoes'
=>
$notificacoes
]);
}
public
function
listarTrab
()
{
$destinatarios
=
Notificacao
::
where
(
'destinatario_id'
,
Auth
()
->
user
()
->
id
)
->
get
();
$remetentes
=
Notificacao
::
where
(
'remetente_id'
,
Auth
()
->
user
()
->
id
)
->
get
();
$notificacoes
=
$destinatarios
->
merge
(
$remetentes
);
return
view
(
'notificacao.listar'
,[
'notificacoes'
=>
$notificacoes
]);
}
}
This diff is collapsed.
Click to expand it.
app/Notificacao.php
0 → 100644
View file @
545187d1
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Notificacao
extends
Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected
$fillable
=
[
'lido'
,
'tipo'
,
'destinatario_id'
,
'remetente_id'
,
'perfil_id'
,
'trabalho_id'
,
];
public
function
destinatario
(){
return
$this
->
belongsTo
(
User
::
class
,
'destinatario_id'
,
'id'
);
}
public
function
remetente
(){
return
$this
->
belongsTo
(
User
::
class
,
'remetente_id'
,
'id'
);
}
public
function
trabalho
(){
return
$this
->
belongsTo
(
Trabalho
::
class
,
'trabalho_id'
,
'id'
);
}
}
This diff is collapsed.
Click to expand it.
database/migrations/2022_01_24_222743_create_notificacaos_table.php
0 → 100644
View file @
545187d1
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateNotificacaosTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'notificacaos'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
integer
(
'remetente_id'
);
$table
->
integer
(
'destinatario_id'
);
$table
->
integer
(
'trabalho_id'
);
$table
->
integer
(
'perfil_id'
)
->
nullable
();
$table
->
boolean
(
'lido'
);
$table
->
integer
(
'tipo'
);
//1 para pediu acesso, 2 para recebeu acesso, 3 para objetivo, 4 atividade, 5 sugestao
$table
->
foreign
(
'remetente_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
$table
->
foreign
(
'trabalho_id'
)
->
references
(
'id'
)
->
on
(
'trabalhos'
);
$table
->
foreign
(
'destinatario_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'notificacaos'
);
}
}
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