Skip to content

Instantly share code, notes, and snippets.

@betinho37
Created June 27, 2018 21:08
Show Gist options
  • Save betinho37/a2a441163eccd6938cda4159949e6810 to your computer and use it in GitHub Desktop.
Save betinho37/a2a441163eccd6938cda4159949e6810 to your computer and use it in GitHub Desktop.
@extends('layouts.app')
@section('content')
<script src="{{ asset('js/menssagem.js') }}"></script>
<h1 align="center" >Publicacões</h1>
@if (Auth::user()->tipousuario == 1)
@forelse ($publicacao->slice(0,1) as $publicacoes)
@if($publicacoes->situacao != 1)
<div style="padding:30px">
<div class="alert alert-danger" role="alert">
<strong>Aviso!</strong> Você tem Publicacões que ainda vão ser validadas.
</div>
</div>
@else
@endif
@empty
@endforelse
@endif
<div class="div1" style="padding:30px">
<a class="btn btn-primary" href="/home" >Voltar</a>
<a class="btn btn-primary" href="/publicacao/create">Nova Publicação</a>
<table align="center" class="table"><p></p>
<th>Nome</th>
<th>Titulo da Imagem</th>
<th>Data</th>
<th>Situação</th>
<th>Opcões</th>
</tr>
@foreach($publicacao as $publicacoes)
<tr>
<td>{{$publicacoes -> nome }}</td>
<td>{{$publicacoes -> titulo }}</td>
<td>{{ date( 'd/m/Y' , strtotime($publicacoes->created_at ))}}</td>
<td>{{isset($publicacoes->situacao) && $publicacoes->situacao == 0 ? 'Pendente' : 'Publicado' }}</td>
<td><a href="{{@url('publicacao').'/edit/'.$publicacoes->id.''}}" class="btn btn-primary">Visualizar</a>
@if (Auth::user()->tipousuario == 0 )
<td><a href="{{@url('publicacao').'/destroy/'.$publicacoes->id.''}}" onclick="confirmacao('1')" class="btn btn-danger">Excluir</a></td>
@else
@endif
</td>
@endforeach
</table>
</div>
@endsection
function confirmacao(id) {
var resposta = confirm("Deseja remover esse registro?");
if (resposta === true) {
window.location.href = "remover.php?id="+id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment