Commit b435880e authored by gxx's avatar gxx

获取所有的项目 所有的日程完成

parent d503d9b2
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/11/29
* Time: 18:58
*/
namespace App\Contracts;
interface TaskServiceContract
{
public function getAll();
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ScheduleController extends Controller
{
//
}
......@@ -2,9 +2,12 @@
namespace App\Http\Controllers;
use App\Contracts\ScheduleServiceContract;
use App\Contracts\StatisticsServiceContract;
use App\Contracts\TaskServiceContract;
use App\Models\Group;
use App\Models\Project;
use App\Models\Task;
use App\Models\User;
use App\Models\UserInfo;
use Carbon\Carbon;
......@@ -13,9 +16,11 @@ use Illuminate\Http\Request;
class StatisticsController extends Controller
{
public function __construct(StatisticsServiceContract $statisticsHandel)
public function __construct(StatisticsServiceContract $statisticsHandel,TaskServiceContract $taskHandle,ScheduleServiceContract $scheduleHandle)
{
$this->mStatistics = $statisticsHandel;
$this->mTask = $taskHandle;
$this->mSchedule = $scheduleHandle;
}
......@@ -37,7 +42,14 @@ class StatisticsController extends Controller
// 查询所有项目
$projects = count(Project::all());
return view('admin/index',compact('newUserCount','newProject','users','projects'));
// 获取所有的任务
$tasks = $this->mTask->getAll()->count();
// 获取所有日程
$schedules = $this->mSchedule->getAll()->count();
return view('admin/index',compact('newUserCount','newProject','users','projects','tasks','schedules'));
}
......
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class TaskController extends Controller
{
//
}
<?php
namespace App\Providers;
use App\Services\TaskService;
use Illuminate\Support\ServiceProvider;
class TaskServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//绑定服务与接口关系
$this->app->singleton("App\Contracts\TaskServiceContract",function(){
return new TaskService();
});
}
}
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/11/29
* Time: 19:00
*/
namespace App\Services;
use App\Contracts\TaskServiceContract;
use App\Models\Task;
class TaskService implements TaskServiceContract
{
public function getAll()
{
$tasks = Task::all();
if ($tasks->isEmpty()){
return null;
}
return $tasks;
}
}
\ No newline at end of file
......@@ -187,6 +187,8 @@ return [
App\Providers\AdminServiceProvider::class,
App\Providers\RoleServiceProvider::class,
App\Providers\PermissionServiceProvider::class,
App\Providers\TaskServiceProvider::class,
App\Providers\ScheduleServiceProvider::class,
Zizaco\Entrust\EntrustServiceProvider::class,
Orangehill\Iseed\IseedServiceProvider::class,
......
......@@ -67,6 +67,72 @@
<!-- ./col -->
</div>
<div class="row">
<!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner" style="background-color: #1b6d85">
<h3> {{$schedules}} </h3>
<p>全部日程</p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner" style="background-color: #31b131">
<h3>{{$tasks}}</h3>
<p>全部任务</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner" style="background-color: #ebccd1">
<h3> 0 </h3>
<p>全部日程</p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner" style="background-color: #afd9ee">
<h3>0</h3>
<p>全部任务</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</div>
<div class="row">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment