Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

pterodactyl/panel

8314 stars
3 code files
View pterodactyl/panel on GitHub

app/Contracts/Repository/TaskRepositoryInterface.php

Open in GitHub
use Pterodactyl\Models\Task;
 
interface TaskRepositoryInterface extends RepositoryInterface
{
public function getTaskForJobProcess(int $id): Task;
 
public function getNextTask(int $schedule, int $index);
}

app/Repositories/Eloquent/TaskRepository.php

Open in GitHub
use Pterodactyl\Models\Task;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Pterodactyl\Contracts\Repository\TaskRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
 
class TaskRepository extends EloquentRepository implements TaskRepositoryInterface
{
public function model()
{
return Task::class;
}
 
public function getTaskForJobProcess(int $id): Task
{
try {
return $this->getBuilder()->with('server.user', 'schedule')->findOrFail($id, $this->getColumns());
} catch (ModelNotFoundException $exception) {
throw new RecordNotFoundException();
}
}
public function getNextTask(int $schedule, int $index)
{
return $this->getBuilder()->where('schedule_id', '=', $schedule)
->where('sequence_id', '=', $index + 1)
->first($this->getColumns());
}
}

app/Contracts/Repository/RepositoryInterface.php

Open in GitHub
namespace Pterodactyl\Contracts\Repository;
 
use Illuminate\Support\Collection;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
 
interface RepositoryInterface
{
/**
* Return an identifier or Model object to be used by the repository.
*
* @return string|\Closure|object
*/
public function model();
 
/**
* Return the model being used for this repository instance.
*
* @return mixed
*/
public function getModel();
 
/**
* Returns an instance of a query builder.
*
* @return mixed
*/
public function getBuilder();
 
// ... other methods
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.