/** * Load the main report page. * * @return string */ public function index() { $fields = $this->_captureReportFields(); $report_levels = ReportLevel::orderBy('id')->lists('name', 'id')->all(); $report_types = ReportType::orderBy('id')->lists('name', 'id')->all(); switch ($fields['report_level_id']) { case ReportLevel::SERVER_LEVEL: $items = Server::orderBy('name')->lists('name', 'id')->all(); break; case ReportLevel::SITE_LEVEL: $items = Site::orderBy('name')->lists('name', 'id')->all(); break; case ReportLevel::SERVICE_LEVEL: $items = Service::orderBy('name')->lists('name', 'id')->all(); break; case ReportLevel::CLIENT_LEVEL: default: $items = Client::orderBy('name')->lists('name', 'id')->all(); break; } return view('report.form', compact('fields', 'report_levels', 'report_types', 'items')); }
/** * Run the report types table seeder. * * @return void */ public function run() { ReportType::truncate(); ReportType::create(['id' => 1, 'name' => 'Daily']); ReportType::create(['id' => 2, 'name' => 'Weekly']); ReportType::create(['id' => 3, 'name' => 'Monthly']); ReportType::create(['id' => 4, 'name' => 'Yearly']); ReportType::create(['id' => 5, 'name' => 'Custom']); }