first change
This commit is contained in:
0
Modules/Meeting/app/Repositories/.gitkeep
Normal file
0
Modules/Meeting/app/Repositories/.gitkeep
Normal file
12
Modules/Meeting/app/Repositories/EventInterface.php
Normal file
12
Modules/Meeting/app/Repositories/EventInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Meeting\Repositories;
|
||||
|
||||
interface EventInterface
|
||||
{
|
||||
public function findAll($filters = [], $limit = null, $offset = null);
|
||||
public function getEventById($eventId);
|
||||
public function delete($eventId);
|
||||
public function create(array $eventDetails);
|
||||
public function update($eventId, array $newDetails);
|
||||
}
|
43
Modules/Meeting/app/Repositories/EventRepository.php
Normal file
43
Modules/Meeting/app/Repositories/EventRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Meeting\Repositories;
|
||||
|
||||
use Modules\Meeting\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('id', $eventId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Meeting/app/Repositories/MeetingInterface.php
Normal file
12
Modules/Meeting/app/Repositories/MeetingInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Meeting\Repositories;
|
||||
|
||||
interface MeetingInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getMeetingById($meetingId);
|
||||
public function delete($meetingId);
|
||||
public function create(array $meetingDetails);
|
||||
public function update($meetingId, array $newDetails);
|
||||
}
|
13
Modules/Meeting/app/Repositories/MeetingMinuteInterface.php
Normal file
13
Modules/Meeting/app/Repositories/MeetingMinuteInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Meeting\Repositories;
|
||||
|
||||
interface MeetingMinuteInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getMeetingMinuteById($meetingId);
|
||||
public function delete($meetingId);
|
||||
public function create(array $meetingDetails);
|
||||
public function update($meetingId, array $newDetails);
|
||||
public function getMeetingMinuteByMeetingId($id);
|
||||
}
|
39
Modules/Meeting/app/Repositories/MeetingMinuteRepository.php
Normal file
39
Modules/Meeting/app/Repositories/MeetingMinuteRepository.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Meeting\Repositories;
|
||||
|
||||
use Modules\Meeting\Models\MeetingMinute;
|
||||
|
||||
|
||||
class MeetingMinuteRepository implements MeetingMinuteInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return MeetingMinute::get();
|
||||
}
|
||||
|
||||
public function getMeetingMinuteById($meetingId)
|
||||
{
|
||||
return MeetingMinute::findOrFail($meetingId);
|
||||
}
|
||||
|
||||
public function delete($meetingId)
|
||||
{
|
||||
MeetingMinute::destroy($meetingId);
|
||||
}
|
||||
|
||||
public function create(array $meetingDetails)
|
||||
{
|
||||
return MeetingMinute::create($meetingDetails);
|
||||
}
|
||||
|
||||
public function update($meetingId, array $newDetails)
|
||||
{
|
||||
return MeetingMinute::whereId($meetingId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function getMeetingMinuteByMeetingId($id)
|
||||
{
|
||||
return MeetingMinute::where('meeting_id', $id)->get();
|
||||
}
|
||||
}
|
36
Modules/Meeting/app/Repositories/MeetingRepository.php
Normal file
36
Modules/Meeting/app/Repositories/MeetingRepository.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Meeting\Repositories;
|
||||
|
||||
use Modules\Meeting\Models\Meeting;
|
||||
|
||||
|
||||
class MeetingRepository implements MeetingInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Meeting::get();
|
||||
}
|
||||
|
||||
public function getMeetingById($meetingId)
|
||||
{
|
||||
return Meeting::findOrFail($meetingId);
|
||||
}
|
||||
|
||||
public function delete($meetingId)
|
||||
{
|
||||
Meeting::destroy($meetingId);
|
||||
}
|
||||
|
||||
public function create(array $meetingDetails)
|
||||
{
|
||||
return Meeting::create($meetingDetails);
|
||||
}
|
||||
|
||||
public function update($meetingId, array $newDetails)
|
||||
{
|
||||
return Meeting::whereId($meetingId)->update($newDetails);
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user