public static function exists($service_id) { $service = Service::where('id', '=', $service_id)->count(); if ($service > 0) { return true; } else { return false; } }
public function getUpdate($business_id, $field, $value) { $first_branch = Branch::where('business_id', '=', $business_id)->first(); $first_service = Service::where('branch_id', '=', $first_branch->branch_id)->first(); if (QueueSettings::serviceExists($first_service->service_id)) { QueueSettings::updateQueueSetting($first_service->service_id, $field, $value); } else { QueueSettings::createQueueSetting(['service_id' => $first_service->service_id, 'date' => mktime(0, 0, 0, date('m'), date('d'), date('Y')), $field => $value]); } return json_encode(['success' => 1]); }
public function run() { $event = Ssms\Event::create(['name' => 'user.add', 'description' => 'When a new user is added']); $this->attach($event, Service::whereName('hipchat')->get()); $event = Ssms\Event::create(['name' => 'user.delete', 'description' => 'When a user is deleted']); $this->attach($event, Service::whereName('hipchat')->get()); $event = Ssms\Event::create(['name' => 'server.up', 'description' => 'When a server is back up after being down']); $this->attach($event, Service::all()); $event = Ssms\Event::create(['name' => 'server.down', 'description' => 'When a server is down (retry threshold breached)']); $this->attach($event, Service::all()); $event = Ssms\Event::create(['name' => 'server.updating', 'description' => 'When a server is updating']); $this->attach($event, Service::where('name', 'email')->orWhere('name', 'hipchat')->get()); $event = Ssms\Event::create(['name' => 'server.restart', 'description' => 'When a server is restarting']); $this->attach($event, Service::whereName('hipchat')->get()); }
public function getServiceNames($outlet_id) { Activity::log(['contentId' => $outlet_id, 'contentType' => 'OutletService', 'action' => 'GetServiceNames', 'description' => 'Get List Service for an Outlet', 'details' => 'Outlet Id: ' . $outlet_id, 'updated' => false]); return Service::where('outlet_id', '=', $outlet_id)->get(); }
ActiveMongo::connect("test"); User::drop(); Service::drop(); /* Create an user for our 'aggregator' */ $user = new User(); $user->username = "******"; $user->password = "******"; $user->save(); /* Now we are going to query for the services for * the new user, it will return an empty * dataset, but we're going to create a 'dynamic' reference * to the 'query'. When this reference is deference * then same 'query' is going to be asked to the database. */ $service = new Service(); $service->where('user', $user->getID())->doQuery(); /* save reference */ $user->services = $service->getReference(TRUE); $user->save(); /* Create one service, note that Service::user is $user->getID() */ $twt = new Twitter(); $twt->user = $user->getID(); $twt->rss = "http://twitter.com/statuses/user_timeline/crodas.rss"; $twt->save(); /* Create another service */ $blg = new Blog(); $blg->user = $user->getID(); $blg->rss = "http://crodas.org/feed/rss"; $blg->save(); /* Create another service */ $blg1 = new Blog();