41 lines
791 B
PHP
41 lines
791 B
PHP
<?php
|
|
|
|
namespace Modules\PMS\Repositories;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Modules\PMS\Models\Task;
|
|
|
|
class TaskRepository implements TaskInterface
|
|
{
|
|
public function findAll()
|
|
{
|
|
return Task::paginate(20);
|
|
}
|
|
|
|
public function getTaskById($TaskId)
|
|
{
|
|
return Task::findOrFail($TaskId);
|
|
}
|
|
|
|
public function delete($TaskId)
|
|
{
|
|
Task::destroy($TaskId);
|
|
}
|
|
|
|
public function create($TaskDetails)
|
|
{
|
|
return Task::create($TaskDetails);
|
|
}
|
|
|
|
public function update($TaskId, array $newDetails)
|
|
{
|
|
return Task::whereId($TaskId)->update($newDetails);
|
|
}
|
|
|
|
public function pluck()
|
|
{
|
|
return Task::pluck(DB::raw('CONCAT(first_name," ", middle_name , " ",last_name) AS full_name'), 'id');
|
|
}
|
|
|
|
}
|