Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion app/Models/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Malico\LaravelNanoid\HasNanoids;

class Campaign extends Model
{
use HasFactory, HasNanoids;
use HasFactory, HasNanoids, SoftDeletes;

protected $fillable = [
'id',
'Title',
'Description',
'meta',
'user_id',
'address_id',
];

protected $casts = [
'meta' => 'array',
Expand Down
12 changes: 11 additions & 1 deletion app/Models/Donation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@ class Donation extends Model
{
use HasFactory, HasNanoids;

protected $fillable = [
'id',
'campaign_id',
'user_id',
'Quantity',
'Description',
'Confirmed_at',
'Status',
];

protected $casts = [
'Confirmed_at' => 'datetime',
];

public function campaign()
{
return $this->belongsTo(Campaign::class);
return $this->belongsTo(Campaign::class, 'campaign_id')->withTrashed();
}

public function user()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function up(): void

$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('address_id')->references('id')->on('addresses')->onDelete('cascade');
$table->softDeletes();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function up(): void
$table->string('Status')->default('pending');
$table->timestamps();

$table->foreign('campaign_id')->references('id')->on('campaigns')->onDelete('cascade');
$table->foreign('campaign_id')->references('id')->on('campaigns')->onDelete('restrict');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions resources/views/donations/historic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
<article>
<a href="{{ $campaign ? url('/campaign/' . $campaign->id) : '#' }}" class="block rounded-xl p-5 bg-[#f0f0f0] dark:bg-neutral-800 shadow hover:bg-[#e0e0e0] dark:hover:bg-neutral-700 transition cursor-pointer flex flex-col sm:flex-row sm:items-center justify-between">
<div class="flex-1">
<div class="text-lg font-semibold text-[#5FCB69] dark:text-[#5FCB69] mb-1">
{{ $campaign->Title ?? 'Campanha removida' }}
<div class="mb-1 flex flex-row gap-4 items-center ">
<p class="text-2xl font-semibold text-[#5FCB69] dark:text-[#5FCB69]">{{ $campaign->Title ?? 'Campanha removida' }}</p>
@if($campaign->deleted_at)
<span class="bg-orange-200 text-orange-800 text-xs font-bold me-2 px-2.5 py-0.5 rounded-full dark:bg-orange-900 dark:text-orange-300">Campanha Desativada</span>
@endif
</div>
<div class="text-sm text-gray-700 dark:text-gray-300 mb-1">
<span class="font-medium">Validador:</span>
Expand Down
43 changes: 43 additions & 0 deletions resources/views/errors/404.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Página Não Encontrada</title>
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-neutral-100 dark:bg-neutral-900 transition-colors duration-300">

<main class="flex items-center justify-center w-screen h-screen px-4">
<div class="flex flex-col items-center text-center space-y-6">

<h1 class="text-9xl font-black text-[#FF5800] drop-shadow-sm">
404
</h1>

<div class="space-y-2">
<h2 class="text-4xl font-bold text-neutral-800 dark:text-white">
Oops! Canal errado.
</h2>
<p class="text-lg text-neutral-600 dark:text-neutral-400 max-w-md">
Parece que você se perdeu nos cabos. Não conseguimos encontrar a página que você está procurando.
</p>
</div>

<a href="/"
class="inline-block px-8 py-3 text-lg font-semibold text-white bg-[#5FCB69] rounded-lg shadow-lg transition-all duration-200 hover:scale-105 hover:shadow-xl focus:outline-none focus:ring-2 focus:ring-[#5FCB69] focus:ring-opacity-50">
Me leve de volta!
</a>

</div>
</main>
<script>
window.addEventListener('DOMContentLoaded', function () {
if (localStorage.getItem('theme') === 'dark')
{
document.documentElement.classList.add('dark');
}
})
</script>
</body>
</html>