<?php
namespace App\Modules\Event;
use App\Models\Event;
class EventRepository {
protected $eventModel;
public function __construct(Event $event){
$this->eventModel = $event;
}
public function takeLatestEvent($limit=null){
if($limit!==null){
return $this->eventModel->latest()->take($limit)->get();
}
return $this->eventModel->latest()->take(10)->get();
}
}