Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
feat(show): add show view
Browse files Browse the repository at this point in the history
  • Loading branch information
tikrack committed Sep 9, 2024
1 parent eba8d54 commit d490df5
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/Controllers/CodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,13 @@ public function index(): void
'codes' => $codes,
]);
}

public function show($id): void
{
$code = Code::find($id);

view('admin.codes.show', [
'code' => $code,
]);
}
}
52 changes: 52 additions & 0 deletions resources/views/admin/codes/show.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@extends("admin.layouts.master")
@section("title", "Salam Admin")

@section("content")
<div class="page-wrapper">
<div class="page-body">
<div class="container-xl">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">کاربران</h3>
</div>
<div class="table-responsive">
<table class="table card-table table-vcenter text-nowrap datatable">
<thead>
<tr>
<th>ایدی</th>
<th>ایدی کاربر</th>
<th>کد</th>
<th>عنوان</th>
<th>ایجاد شده در</th>
<th>اپدیت شده در</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($codes as $code)
<tr class="@if($code["user_id"] === user()["id"]) bg-success-subtle @endif">
<td>{{ $code["id"] }}</td>
<td>{{ $code["user_id"] }}</td>
<td>{{ substr($code["code"], 0, 25) }}</td>
<td>{{ substr($code["title"], 0, 25) }}</td>
<td>{{ $code["created_at"] }}</td>
<td>{{ $code["updated_at"] }}</td>
<td class="text-end">
<a href="/admin/codes/show/{{ $code["id"] }}" class="btn btn-warning rounded-3">نمایش</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

@section("script")

@endsection
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

Flight::group('/codes', function () {
Flight::route('GET /', [new CodeController, 'index']);
Flight::route('GET /show/@id', [new CodeController, 'show']);
});

}, [new Admin]);
Expand Down

0 comments on commit d490df5

Please sign in to comment.