Commit 5de5a599 authored by Gabriel-31415's avatar Gabriel-31415
Browse files

first commit

parents
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Closure;
class IsTemp
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if(Auth()->user()->usuarioTemp == true){
return redirect('perfil');
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class EmailLembrete extends Mailable
{
use Queueable, SerializesModels;
public $user;
public $subject;
public $informacoes;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($user, $subject, $informacoes = "")
{
$this->user = $user;
$this->subject = $subject;
$this->informacoes = $informacoes;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$subject = 'Eventos - Lembrete de Evento';
return $this->from('lmtsteste@gmail.com', 'Eventos - LMTS')
->subject($this->subject)
->view('emails.emailLembreteRevisor')
->with([
'user' => $this->user,
'info' => $this->informacoes,
]);
}
}
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class EmailParaUsuarioNaoCadastrado extends Mailable
{
use Queueable, SerializesModels;
public $nomeUsuarioPai;
public $nomeTrabalho;
public $nomeFuncao;
public $nomeEvento;
public $senhaTemporaria;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(String $nomeUsuarioPai, String $nomeTrabalho, String $nomeFuncao, String $nomeEvento, String $senhaTemporaria)
{
$this->nomeUsuarioPai = $nomeUsuarioPai;
$this->nomeTrabalho = $nomeTrabalho;
$this->nomeFuncao = $nomeFuncao;
$this->nomeEvento = $nomeEvento;
$this->senhaTemporaria = $senhaTemporaria;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('emails.usuarioNaoCadastrado');
}
}
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class EventoCriado extends Mailable
{
use Queueable, SerializesModels;
public $user;
public $subject;
public $informacoes;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($user, $subject, $informacoes = "")
{
$this->user = $user;
$this->subject = $subject;
$this->informacoes = $informacoes;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from('lmtsteste@gmail.com', 'Eventos - LMTS')
->subject($this->subject)
->view('emails.emailEventoCriado')
->with([
'user' => $this->user,
'info' => $this->informacoes,
]);
}
}
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class SubmissaoTrabalho extends Mailable
{
use Queueable, SerializesModels;
public $user;
public $subject;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($user, $subject)
{
$this->user = $user;
$this->subject = $subject;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from('lmtsteste@gmail.com', 'Eventos - LMTS')
->subject($this->subject)
->view('emails.submissaoTrabalho');
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Mensagem extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'titulo', 'conteudo', 'data', 'categoriaRemetente', 'comissaoId',
];
public function user(){
return $this->belongsTo('App\User', 'comissaoId');
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Modalidade extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'nome',
];
public function trabalho(){
return $this->hasMany('App\Trabalho', 'modalidadeId');
}
}
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class recuperacaoSenha extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($token)
{
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Recuperação de senha')
->greeting('Olá;!')
->line('Você está recebendo este e-mail porque nós recebemos uma requisição de redefinição de senha para sua conta.')
->action('REDEFINIR SENHA', route('password.reset', $this->token))
->line('Se não foi você que solicitou esta recuperação, apenas ignore este e-mail.')
->line('Obrigado por usar o nosso sistema.')
->markdown('vendor.notifications.email');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Parecer extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'resultado', 'revisorId', 'trabalhoId',
];
public function user(){
return $this->belongsTo('App\User', 'revisorId');
}
public function trabalho(){
return $this->belongsTo('App\Trabalho', 'trabalhoId');
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Pertence extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'revisorId', 'areaId',
];
public function user(){
return $this->belongsTo('App\User', 'revisorId');
}
public function area(){
return $this->belongsTo('App\Area', 'areaId');
}
}
<?php
namespace App\Policies;
use App\User;
use App\Evento;
use Illuminate\Auth\Access\HandlesAuthorization;
class EventoPolicy
{
use HandlesAuthorization;
/**
* Create a new policy instance.
*
* @return void
*/
public function __construct()
{
//
}
public function isCoordenador(User $user, Evento $evento){
return $user->id === $evento->coordenador->id;
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
'App\Evento' => 'App\Policies\EventoPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment