-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table + model + seeder + factory postari terminat ++ table & paginare…
… backend pentru pagina de postari termiant
- Loading branch information
Showing
23 changed files
with
136 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\Posts; | ||
use Illuminate\Http\Request; | ||
|
||
class PostsController extends Controller | ||
{ | ||
public function index(){ | ||
$posts = Posts::orderByDesc('created_at')->paginate(); | ||
return view('admin.posts.posts', compact('posts')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
resources/views/admin/partials/dashboard-partials/topbar.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
@extends('admin.layouts.layout-dashboard') | ||
@section('title', 'Gestionare Postări') | ||
@section('content') | ||
<ol class="breadcrumb mb-4"> | ||
<li class="breadcrumb-item"><a href="{{route('dashboard')}}">Panou Control</a></li> | ||
<li class="breadcrumb-item active">Postări</li> | ||
</ol> | ||
@if(session()->has('success')) | ||
<div class="alert alert-success" id="alert"> | ||
{{ session()->get('success') }} | ||
</div> | ||
@endif | ||
@if(session()->has('error')) | ||
<div class="alert alert-danger" id="alert"> | ||
{{ session()->get('error') }} | ||
</div> | ||
@endif | ||
<div class="card mb-4"> | ||
<div class="card-header"> | ||
Postări - {{$posts->count() }} | ||
@can('author-rights')<a href="" class=" float-end ">Adaugă Postare</a>@endcan | ||
</div> | ||
<div class="card-body"> | ||
<table class="table table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>Titlu</th> | ||
<th>Autor</th> | ||
<th>Thumbnail</th> | ||
<th>Vizualizări</th> | ||
<th>Meta Description & Meta Keywords</th> | ||
<th>Acțiuni</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach ($posts as $post ) | ||
<tr> | ||
<td>{{ $post->title }} <br> <span class="under-info">{{ $post->created_at->format('F j, Y') }}</span></td> | ||
<td>{{ $post->user_id }}</td> | ||
<td><img style="max-width: 100px; max-height: 100px"class="img-thumbnail" src="{{ asset('../images/posts/' .$post->photo) }}"></td> | ||
<td>{{ $post->views }}</td> | ||
<td> | ||
{{$post->meta_description}} | ||
<br> | ||
<span id="keywords" class="badge bg-primary">{{$post->meta_keywords}}</span> | ||
</td> | ||
<td class="text-center"> | ||
<a href="{{route('users.edit-form', $post->id)}}" class="butoane text-success" title="Editează utilizator"><i class="fa-solid fa-xl fa-pen-to-square"></i></a> | ||
| ||
<form id="delete-form-{{$post->id}}" action="{{route('users.delete', $post->id)}}" method="post" style="display:inline-block;"> | ||
@csrf | ||
@method('DELETE') | ||
</form> | ||
<button class="butoane text-danger" title="Șterge postare" onclick="if(confirm('Confirmați ștergerea postării {{$post->title}}?')){ | ||
event.preventDefault(); | ||
document.getElementById('delete-form-'+{{$post->id}}).submit();} | ||
"><i class="fa-sharp fa-xl fa-solid fa-trash"></i></button> | ||
</td> | ||
</tr> | ||
@endforeach | ||
</tbody> | ||
<tfoot> | ||
{{ $posts->links() }} | ||
</tfoot> | ||
</table> | ||
</div> | ||
</div> | ||
@endsection | ||
@section('custom-css') | ||
<style> | ||
.butoane{ | ||
text-decoration: none !important; | ||
background:none !important; | ||
border:none !important; | ||
} | ||
.user-avatar{ | ||
max-height: 50px; | ||
max-width: 50px; | ||
} | ||
.under-info{ | ||
color: gray; | ||
font-size: 12px; | ||
} | ||
</style> | ||
@endsection | ||
@section('custom-js') | ||
<script> | ||
setTimeout(()=>{ | ||
document.getElementById('alert').style.display = 'none'; | ||
}, 3000); | ||
</script> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters