Пример #1
0
 /**
  * Loads the client status page.
  * 
  * @param unsigned integer $id
  * @return string
  */
 public function client($id = NULL)
 {
     if (is_null($id)) {
         return redirect('status');
     }
     $client = Client::find($id);
     return view('status.client', compact('client'));
 }
Пример #2
0
 /**
  * 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'));
 }
Пример #3
0
 /**
  * Run the services table seeds.
  * 
  * @return void
  */
 public function run()
 {
     Service::truncate();
     $clients = Client::all()->lists('id');
     foreach ($clients as $client) {
         $limit = rand(2, 10);
         for ($i = 1; $i < $limit; $i++) {
             Service::create(['id' => "{$client}" . str_pad($i, 3, '0', STR_PAD_LEFT), 'name' => "Sample Service {$i}", 'enabled' => rand(0, 1), 'description' => "Sample service {$i}", 'client_id' => "{$client}"]);
         }
     }
 }
Пример #4
0
 /**
  * Get all enabled clients.
  * 
  * @return collection of Dodona\Client
  */
 public static function getEnabled()
 {
     return Client::where('enabled', 1)->get();
 }