Restructure where models are stored (#1476)

The idea is to clean the repository a little bit by moving models into their respective folders.
This commit is contained in:
Régis Freyd
2018-06-14 20:49:12 -04:00
committed by GitHub
parent 87077b6ad4
commit 29197090a7
234 changed files with 1362 additions and 1110 deletions
@@ -2,7 +2,10 @@
namespace App\Http\Controllers\Api\Statistics;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Models\Instance\Instance;
use App\Models\Instance\Statistic;
use App\Http\Controllers\Api\ApiController;
class ApiStatisticsController extends ApiController
@@ -19,20 +22,20 @@ class ApiStatisticsController extends ApiController
}
// Collecting statistics
$statistic = \App\Statistic::orderBy('created_at', 'desc')->first();
$instance = \App\Instance::first();
$statistic = Statistic::orderBy('created_at', 'desc')->first();
$instance = Instance::first();
// Get the date of the monday of last week
$dateMondayLastWeek = \Carbon\Carbon::now()->subDays(7);
$dateMondayLastWeek = Carbon::now()->subDays(7);
$dateMondayLastWeek = $dateMondayLastWeek->startOfWeek();
// Get the date of the sunday of last week
$dateSundayLastWeek = \Carbon\Carbon::now()->subDays(7);
$dateSundayLastWeek = Carbon::now()->subDays(7);
$dateSundayLastWeek = $dateSundayLastWeek->endOfWeek();
// Get the number of users last monday
$instanceLastMonday = \App\Statistic::whereDate('created_at', '=', $dateMondayLastWeek->format('Y-m-d'))->first();
$instanceLastSunday = \App\Statistic::whereDate('created_at', '=', $dateSundayLastWeek->format('Y-m-d'))->first();
$instanceLastMonday = Statistic::whereDate('created_at', '=', $dateMondayLastWeek->format('Y-m-d'))->first();
$instanceLastSunday = Statistic::whereDate('created_at', '=', $dateSundayLastWeek->format('Y-m-d'))->first();
$numberNewUsers = 0;
if ($instanceLastMonday && $instanceLastSunday) {