feat: display all pending tasks on the dashboard (#1909)

This commit is contained in:
Régis Freyd
2018-10-11 21:59:15 -04:00
committed by GitHub
parent 379d84879f
commit 4a1252d1ce
8 changed files with 80 additions and 10 deletions
@@ -10,6 +10,7 @@ use App\Models\Contact\Contact;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use App\Http\Resources\Debt\Debt as DebtResource;
use App\Http\Resources\Task\Task as TaskResource;
class DashboardController extends Controller
{
@@ -142,6 +143,23 @@ class DashboardController extends Controller
return $debtsCollection;
}
/**
* Get tasks for the dashboard.
*
* @return Collection
*/
public function tasks()
{
$tasksCollection = collect([]);
$tasks = auth()->user()->account->tasks()->where('completed', 0)->get();
foreach ($tasks as $task) {
$tasksCollection->push(new TaskResource($task));
}
return $tasksCollection;
}
/**
* Save the current active tab to the User table.
*/