Commit d336a6af authored by Mirzat's avatar Mirzat 🤕

database migration error

parent a131f336
...@@ -16,4 +16,5 @@ interface ScheduleServiceContract ...@@ -16,4 +16,5 @@ interface ScheduleServiceContract
public function update($id ,$title ,$content ,$ends_at ,$starts_at); public function update($id ,$title ,$content ,$ends_at ,$starts_at);
public function get($id); public function get($id);
public function getAll(); public function getAll();
public function getCount();
} }
\ No newline at end of file
...@@ -13,4 +13,5 @@ interface TaskServiceContract ...@@ -13,4 +13,5 @@ interface TaskServiceContract
{ {
public function getAll(); public function getAll();
public function getTaskCount();
} }
\ No newline at end of file
...@@ -43,10 +43,10 @@ class StatisticsController extends Controller ...@@ -43,10 +43,10 @@ class StatisticsController extends Controller
$projects = count(Project::all()); $projects = count(Project::all());
// 获取所有的任务 // 获取所有的任务
$tasks = $this->mTask->getAll()->count(); $tasks = $this->mTask->getTaskCount();
// 获取所有日程 // 获取所有日程
$schedules = $this->mSchedule->getAll()->count(); $schedules = $this->mSchedule->getCount();
return view('admin/index',compact('newUserCount','newProject','users','projects','tasks','schedules')); return view('admin/index',compact('newUserCount','newProject','users','projects','tasks','schedules'));
......
...@@ -50,7 +50,7 @@ class AdminService implements AdminServiceContract ...@@ -50,7 +50,7 @@ class AdminService implements AdminServiceContract
$admin->password = bcrypt($password); $admin->password = bcrypt($password);
$admin->save(); $admin->save();
if ($admin) { if ($admin) {
if (count($roles) > 0) { if ($roles!=null) {
foreach ($roles as $role) { foreach ($roles as $role) {
$adminRole = new RoleAdmin(); $adminRole = new RoleAdmin();
$adminRole->admin_id = $admin->id; $adminRole->admin_id = $admin->id;
......
...@@ -85,4 +85,9 @@ class ScheduleService implements ScheduleServiceContract ...@@ -85,4 +85,9 @@ class ScheduleService implements ScheduleServiceContract
return $schedules; return $schedules;
} }
} }
public function getCount()
{
return Schedule::count();
}
} }
\ No newline at end of file
...@@ -23,4 +23,9 @@ class TaskService implements TaskServiceContract ...@@ -23,4 +23,9 @@ class TaskService implements TaskServiceContract
} }
return $tasks; return $tasks;
} }
public function getTaskCount()
{
return Task::count();
}
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ class EntrustSetupTables extends Migration ...@@ -29,7 +29,7 @@ class EntrustSetupTables extends Migration
->onUpdate('cascade')->onDelete('cascade'); ->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles') $table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade'); ->onUpdate('cascade')->onDelete('cascade');
$table->increments("id");
$table->primary(['admin_id', 'role_id']); $table->primary(['admin_id', 'role_id']);
}); });
......
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