Skip to content
Open

pr #11

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
568c672
add admin guides and site info
fauzymadani Feb 25, 2025
e85e2f0
fix Missing required parameter for [Route: articles.show] [URI: arti…
fauzymadani Feb 25, 2025
204a20a
fix not found in articles and reindent
fauzymadani Mar 9, 2025
846c9cd
add privacy policy and about page
fauzymadani Mar 12, 2025
4a85178
change monero address
fauzymadani Mar 12, 2025
faa1da3
very small commit
fauzymadani Apr 9, 2025
5d25faa
chores: add api
fauzymadani Apr 23, 2025
7e9ab23
add database
fauzymadani Apr 23, 2025
8d2f4ad
feat(books): add a thumbnail for books
fauzymadani May 19, 2025
ec7becb
fix(books): fix an error in buku.edit
fauzymadani May 19, 2025
418732c
feat(frontend): added a new feature where user can check their books …
fauzymadani May 20, 2025
dff1cea
searc
adityape71 May 21, 2025
13030df
search
adityape71 May 21, 2025
526be1b
fix(search-feature): fix the search feature and fix some minor bugs
fauzymadani May 21, 2025
bf5cab5
refactor(search-feature): improve search time
fauzymadani May 21, 2025
f5f8842
remove accidentall file
fauzymadani May 21, 2025
df1e210
style(article): change some font in article
fauzymadani May 21, 2025
5202e93
change script location for reducing latency
fauzymadani May 26, 2025
572dde7
blabla
fauzymadani May 26, 2025
2f43f0d
feat: added a bug tracker system feature
fauzymadani Jun 2, 2025
b84cbd5
feat(bug-tracker-system): user can now edit a bug with token
fauzymadani Jun 3, 2025
e1482c8
style(bts): change styling a little bit
fauzymadani Jun 3, 2025
aab6da0
feat: add some unnecessary feature
fauzymadani Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,33 @@ To check which `php.ini` to edit, you can run:
```
it is recomended to change or edit all of listed `php.ini` files.

## Cronjob
there are 1 cronjob available for generating a new hash file to be validated, can be triggered with:
```bash
php artisan hash:validate
```
to start cronhjob automaticcaly every minute, run:
```bash
php artisan schedule:run
```
there are one cronjob that run every minute to update hash running in `Console\Commands\ValidateHash.php`
cronjob can be checked with
```bash
$ crontab -l # example
* * * * * cd /path/to/your-laravel-project && php artisan schedule:run >> /dev/null 2>&1
```

## Donations

<img height="100" src="https://res.coinpaper.com/coinpaper/f_webp,c_limit,w_3840,q_auto:good/monero_xmr_logo_d7cfda451e.png">

monero: `42uxCqPSig2JZa6CBnS8pSHdxnrj7q4wqVN2xjZkfFZn4adJHyjuEpxKmcWSGjFoixTteDPM2b7tNAkzKdiMkpTY2Yd6XYh`
monero:
```bash
8AaocxJgCRciXBg5zowkpfDT5uCM6cCcdSbBqwFH4bbja5G4J7SWfnnC6PyjFBUp3p3c19RkRNsAtiRUZ4FVjU9cAnheTNr
```

## Mirror
- https://codeberg.org/fauzymadani/Project-Web.backup

## Contributors
<a href="https://github.com/faqihboyy/Prjoect-Web/graphs/contributors">
Expand Down
20 changes: 20 additions & 0 deletions app/Http/Controllers/Api/BukuApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Buku;
use Illuminate\Http\JsonResponse;

class BukuApiController extends Controller
{
public function index(): JsonResponse
{
$buku = Buku::with('kategori')->get();
return response()->json([
'success' => true,
'message' => 'List data buku',
'data' => $buku,
]);
}
}
28 changes: 24 additions & 4 deletions app/Http/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,33 @@ public function store(Request $request)
return redirect()->route('admin.articles.index')->with('success', 'Artikel berhasil dibuat.');
}

public function show($id)
/* public function show($slug) */
/* { */
/* $article = Article::where('slug', $slug)->firstOrFail(); */
/* return view('articles.show', compact('article')); */
/* } */

public function show($slug)
{
/*$article = Article::where('slug', $slug)->firstOrFail();*/
$article = Article::where('id', $id)->firstOrFail();
return view('articles.show', compact('article'));
// Coba cari berdasarkan slug artikel
$article = Article::where('slug', $slug)->first();
if ($article) {
return view('articles.show', compact('article'));
}

// Jika tidak ditemukan, dan slug adalah angka → asumsikan ID buku
if (is_numeric($slug)) {
$buku = \App\Models\Buku::find($slug);
if ($buku) {
return view('artikel.buku', compact('buku'));
}
}

abort(404); // Kalau nggak ditemukan apa-apa
}



public function edit(Article $article)
{
return view('admin.articles.edit', compact('article'));
Expand Down
175 changes: 175 additions & 0 deletions app/Http/Controllers/BugController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?php

namespace App\Http\Controllers;

use App\Models\Bug;
use Illuminate\Http\Request;
use Parsedown;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Http;

class BugController extends Controller
{
public function index()
{
$bugs = Bug::where('active', true)->latest()->get();

// Ambil changelog dari GitHub
$username = 'fauzymadani'; // Ganti ini sesuai user GitHub kamu
$repo = 'Project-Web'; // Ganti ini sesuai repo kamu
$url = "https://api.github.com/repos/$username/$repo/releases";

$response = Http::get($url);
$releases = [];

if ($response->successful()) {
$releases = $response->json();
}

return view('bugs.index', compact('bugs', 'releases'));
}

public function create()
{
// Selalu aktifkan CAPTCHA setiap kali buka form
session()->put('require_captcha', true);

$a = rand(1, 10);
$b = rand(1, 10);
$question = "$a + $b";
$answer = $a + $b;
session()->put('captcha_answer', $answer);

return view('bugs.create', compact('question'));
}

public function store(Request $request)
{
$request->validate([
'title' => 'required|string|max:255',
'description' => 'required|string',
'label' => 'nullable|string|max:100',
]);

$bug = new Bug();
$bug->title = $request->title;
$bug->description = $request->description;
$bug->label = $request->label;

$bug->edit_token = Str::random(32);

$bug->save();

return redirect()->route('bugs.show', $bug)->with('token', $bug->edit_token);
}

public function show(Bug $bug)
{
$parsedown = new Parsedown();
$htmlDescription = $parsedown->text($bug->description);

return view('bugs.show', compact('bug', 'htmlDescription'));
}

// Edit dengan validasi token dari param request
public function edit(Bug $bug, Request $request)
{
if ($request->token !== $bug->edit_token) {
abort(403, 'Token tidak valid.');
}

return view('bugs.edit', compact('bug'));
}

public function update(Request $request, Bug $bug)
{
if ($request->token !== $bug->edit_token) {
abort(403, 'Token tidak valid.');
}

$request->validate([
'title' => 'required|string|max:255',
'description' => 'required|string',
'label' => 'nullable|string|max:100',
]);

$bug->update([
'title' => $request->title,
'description' => $request->description,
'label' => $request->label,
]);

return redirect()->route('bugs.show', $bug)->with('success', 'Bug berhasil diperbarui.');
}

public function destroy(Request $request, Bug $bug)
{
if ($request->token !== $bug->edit_token) {
abort(403, 'Token tidak valid.');
}

$bug->delete();

return redirect()->route('bugs.index')->with('success', 'Bug berhasil dihapus.');
}

// Form input token
public function enterToken()
{
return view('bugs.token');
}

// Proses validasi token dan redirect ke edit form
public function processToken(Request $request)
{
$request->validate([
'token' => 'required|string|size:32',
]);

$bug = Bug::where('edit_token', $request->token)->first();

if (!$bug) {
return redirect()->back()->withErrors(['token' => 'Token tidak ditemukan atau tidak valid.']);
}

return redirect()->route('bugs.edit.token', ['token' => $request->token]);
}

// Menampilkan form edit berdasarkan token
public function editByToken($token)
{
$bug = Bug::where('edit_token', $token)->firstOrFail();

return view('bugs.edit', compact('bug'));
}

// Simpan perubahan dari form edit via token
public function updateByToken(Request $request, $token)
{
$bug = Bug::where('edit_token', $token)->firstOrFail();

$request->validate([
'title' => 'required|string|max:255',
'description' => 'required|string',
'label' => 'nullable|string|max:100',
]);

$bug->update([
'title' => $request->title,
'description' => $request->description,
'label' => $request->label,
]);

return redirect()->route('bugs.show', $bug)->with('success', 'Bug berhasil diperbarui.');
}

public function destroyByToken(Request $request)
{
$token = $request->input('token');
$bug = Bug::where('edit_token', $token)->firstOrFail();
$bug->delete();

return redirect()->route('bugs.index')->with('success', 'Laporan berhasil dihapus.');
}

}
Loading