1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00
invoiceninja/app/Http/Controllers/TimeTrackerController.php

35 lines
1006 B
PHP
Raw Normal View History

2017-09-17 13:55:36 +02:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Models\Task;
2017-12-20 09:41:40 +01:00
use App\Models\TaskStatus;
2017-09-18 11:46:29 +02:00
use App\Models\Client;
use App\Models\Project;
2017-09-17 13:55:36 +02:00
class TimeTrackerController extends Controller
{
public function index()
{
2017-09-17 18:27:47 +02:00
$user = auth()->user();
$account = $user->account;
2017-10-03 09:06:58 +02:00
if (! $account->hasFeature(FEATURE_TASKS)) {
2017-09-25 08:37:51 +02:00
return trans('texts.tasks_not_enabled');
}
2017-09-17 13:55:36 +02:00
$data = [
2017-09-17 15:17:34 +02:00
'title' => trans('texts.time_tracker'),
2017-12-20 09:41:40 +01:00
'tasks' => Task::scope()->with('project', 'client.contacts', 'task_status')->whereNull('invoice_id')->get(),
2017-09-18 11:46:29 +02:00
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'projects' => Project::scope()->with('client.contacts')->orderBy('name')->get(),
2017-12-20 09:41:40 +01:00
'statuses' => TaskStatus::scope()->orderBy('sort_order')->get(),
2017-09-17 18:27:47 +02:00
'account' => $account,
2017-09-17 13:55:36 +02:00
];
2017-09-24 14:42:24 +02:00
return view('tasks.time_tracker', $data);
2017-09-17 13:55:36 +02:00
}
}