first commit

This commit is contained in:
Sampanna Rimal
2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Event;
class EventRepository implements EventInterface
{
public function findAll($filters = [], $limit = null, $offset = null)
{
return Event::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("start_date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->whereDate("end_date", "<=", $filters["end_date"]);
}
})->latest()->get();
}
public function getEventById($eventId)
{
return Event::findOrFail($eventId);
}
public function delete($eventId)
{
Event::destroy($eventId);
}
public function create(array $eventDetails)
{
return Event::create($eventDetails);
}
public function update($eventId, array $newDetails)
{
return Event::where('event_id', $eventId)->update($newDetails);
}
}