/** * @inheritdoc */ public function handle($arguments) { if (!Cache::has('site-' . $arguments)) { $this->replyWithMessage("Não foi encontrado nenhum site com esse argumento."); return; } $site = Cache::get('site-' . $arguments); // Validate if the URL isn't on the database yet if (Site::where('url', '=', $site)->first() != null) { $this->replyWithMessage("O site {$site} já se encontra na base de dados."); return; } $site_obj = new Site(); $site_obj->url = $site; $site_obj->save(); $this->replyWithMessage($site . " foi adicionado à base de dados.", true); // Notify the sitesbloqueados.pt about the new site $url = 'https://sitesbloqueados.pt/wp-json/ahoy/refresh'; $cmd = "curl -X GET -H 'Content-Type: application/json'"; $cmd .= " " . "'" . $url . "'"; $cmd .= " > /dev/null 2>&1 &"; exec($cmd, $output); // Flush the PAC cache Cache::tags(['generate_pac'])->flush(); // Remove the cache Cache::forget('site-' . $arguments); Cache::forget('site-list'); }
/** * Find a site based on province, city and slug input * * @param string $province * @param string $city * @param string $slug * * @return mixed */ public function findByProvinceCity($province, $city, $slug) { $p = new Province(); $province = $p->where('slug', $province)->first(); $c = new City(); $city = $c->where(['province_id' => $province->id, 'slug' => $city])->first(); $s = new Site(); $site = $s->where(['city_id' => $city->id, 'slug' => $slug])->first(); return $site; }
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // :00 :20 :40 Ping all the update URLs for site/variable // Limit to Red Butte sites $siteCodeContains = ['RB_']; // $siteCodeContains = ['RB_', 'PR_', 'LR_']; try { foreach ($siteCodeContains as $piece) { $sites = Site::where('sitecode', 'LIKE', '%' . $piece . '%')->get(); foreach ($sites as $site) { $series = DB::table('series')->select('variablecode')->where('sitecode', '=', $site->sitecode)->get(); foreach ($series as $s) { $sitecode = $site->sitecode; $variablecode = $s->variablecode; $url = url('/sites/' . $site->sitecode . '/' . $s->variablecode . '/update'); $schedule->exec("wget -O/dev/null {$url}")->cron('0,20,40 * * * *'); } } } } catch (\Exception $ex) { // Ignore all exceptions... this will catch if 'php artisan migration' hasn't been done yet } // :10 :30 :50 Ping the update URLs for cameras $url = url('/cameras/update'); $schedule->exec("wget -O/dev/null {$url}")->cron('10,30,50 * * * *'); }
/** * Run the database seeds. * * @return void */ public function run() { Site::create(['idSite' => 1, 'nomSite' => 'Gap (site de)', 'adr1Site' => 'adresse 1', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 5061]); Site::create(['idSite' => 2, 'nomSite' => 'Schuman (site de)', 'adr1Site' => 'adresse 2', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13001]); Site::create(['idSite' => 3, 'nomSite' => 'Jas de Boufan (site de)', 'adr1Site' => 'adresse 2', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13001]); Site::create(['idSite' => 4, 'nomSite' => 'MontPerrin (site de)', 'adr1Site' => 'adresse 2', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13001]); Site::create(['idSite' => 5, 'nomSite' => 'Gaston Berger (site de)', 'adr1Site' => 'adresse 2', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13001]); Site::create(['idSite' => 6, 'nomSite' => 'IRT (site d\' )', 'adr1Site' => 'adresse 2', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13001]); Site::create(['idSite' => 7, 'nomSite' => 'L\'Arbois (site de)', 'adr1Site' => 'adresse 2', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13001]); Site::create(['idSite' => 8, 'nomSite' => 'Arles (site de)', 'adr1Site' => 'adresse 3', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 84007]); Site::create(['idSite' => 9, 'nomSite' => 'Avignon (site d\')', 'adr1Site' => 'adresse 3', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 84007]); Site::create(['idSite' => 10, 'nomSite' => 'Aubagne (site d\')', 'adr1Site' => 'adresse 4', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13005]); Site::create(['idSite' => 11, 'nomSite' => 'Digne-les-bains (site de)', 'adr1Site' => 'adresse 5', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 4070]); Site::create(['idSite' => 12, 'nomSite' => 'La ciota (site de)', 'adr1Site' => 'adresse 6', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13028]); Site::create(['idSite' => 13, 'nomSite' => 'Puyricard (site de)', 'adr1Site' => 'adresse 7', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13921]); Site::create(['idSite' => 14, 'nomSite' => 'Chateau Gombert (site de)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 15, 'nomSite' => 'Virgile Marron (site de)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 16, 'nomSite' => 'Luminy (site de)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 17, 'nomSite' => 'Nord (site)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 18, 'nomSite' => 'Pharo (site du)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 19, 'nomSite' => 'Saint Charles (site de)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 20, 'nomSite' => 'Saint Jérôme (site de)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 21, 'nomSite' => 'Timone (site de la)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13055]); Site::create(['idSite' => 22, 'nomSite' => 'Salon de Provence (site de)', 'adr1Site' => 'adresse 8', 'adr2Site' => NULL, 'idUniv' => 1, 'inseeVille' => 13103]); }
/** * Execute the console command. * * @return mixed */ public function handle() { //check if have entry for today //check if locked //if good kaliwali //else populate with zeroes //then lock if (Attendance::latest('att_date')->first()->att_date != Carbon::today()) { $currentDate = new Attendance(); $currentDate->att_date = Carbon::today(); $holiday = 0; if (Carbon::today()->format('l') == 'Friday' || Holiday::where('holidate', Carbon::today())->first() != null) { $holiday = 1; } $currentDate->holiday = $holiday; $currentDate->save(); } foreach (Site::all() as $site) { foreach ($site->labor as $labor) { if ($labor->attendance()->where('att_date', Carbon::today()->format('Y-m-d G:i:s'))->first() != null) { $labor->attendance()->where('att_date', Carbon::today()->format('Y-m-d G:i:s'))->first()->pivot->update(['locked' => 'true']); } else { Attendance::latest('att_date')->first()->labor()->attach($labor->id); $att = $labor->attendance()->where('att_date', Carbon::today()->format('Y-m-d G:i:s'))->first(); $att->pivot->locked = 'true'; $att->pivot->attended = $att->holiday == 1 ? 1 : 0; $att->pivot->ot = 0; $att->pivot->bot = 0; $att->pivot->site = $labor->site->code; $att->pivot->save(); } } } }
/** * Create a new password controller instance. * * @param \Illuminate\Contracts\Auth\Guard $auth * @param \Illuminate\Contracts\Auth\PasswordBroker $passwords * @return void */ public function __construct(Guard $auth, PasswordBroker $passwords) { $this->auth = $auth; $this->passwords = $passwords; View::share(array('site' => Site::all()->first())); $this->middleware('guest'); }
/** * Bootstrap the application services. * * @return void */ public function boot(Guard $auth, Request $request) { // view()->composer('*', function ($view) use($auth, $request) { $uri = $request->path(); $uri = explode("/", $uri); $breadcrumb = "<li>Home</li>"; $stopped = false; $menuPath = ""; foreach ($uri as $segment) { if (is_numeric($segment)) { $stopped = true; } else { $breadcrumb .= "<li>" . ucfirst($segment) . "</li>"; if (!$stopped) { $menuPath = $menuPath . "/" . $segment; } } } $allSites = array(); foreach (Site::orderBy('name', 'ASC')->get() as $site) { $allSites[$site->id] = $site->name; } $view->with('user', $auth->user())->with('breadcrumb', $breadcrumb)->with('menupath', $menuPath)->with('siteList', $allSites); }); view()->composer('modals.pressJob', function ($view) use($auth, $request) { $presses = \App\Press::where('site_id', session('site'))->get(); $view->with('presses', $presses); }); }
/** * Create a new controller instance. * * @return void */ public function __construct() { $this->site = Site::all()->first(); View::share('site', $this->site); /*$this->middleware('guest');*/ $this->middleware('auth'); }
public function __construct() { $keyword = Site::getInstance()->getSubdomain(); $twitterScreenName = Site::getInstance()->getTwitterScreenName(); $scraperObj = false; $this->socialMediaObj = new SocialMedia($keyword, 'yelp', $scraperObj); $this->yelpAdapter = new YelpAdapter(); }
public function index() { $events = \App\Event::get(); $sliders = \App\Slider::get(); $services = \App\Service::get(); $site = \App\Site::where('active', '1')->firstOrFail(); return view('pages.index', ['events' => $events, 'sliders' => $sliders, 'services' => $services, 'site' => $site]); }
public function run() { $faker = Faker::create('en_GB'); $sites = [['The Hastings Academy', 'tha', 1, '0098c3', 'secondary', 1], ['The St Leonards Academy', 'tsla', 1, '47068c', 'secondary', 1]]; foreach (range(1, count($sites)) as $index) { $site = Site::create(['name' => $sites[$index - 1][0], 'slug' => $sites[$index - 1][1], 'domain_controller_id' => $sites[$index - 1][2], 'hex_color' => $sites[$index - 1][3], 'type' => $sites[$index - 1][4], 'trust_id' => $sites[$index - 1][5]]); $site->groups()->create(['name' => $sites[$index - 1][0], 'open' => 1, 'service_provider' => 0, 'default' => 1]); } }
/** * Execute the console command. * * @return mixed */ public function handle() { $arguments = $this->argument(); if (Site::create($arguments)) { $this->info('Site created successfully'); } else { $this->error('Site was not created'); } }
public function app() { // Get RB sites that are not USGS // (USGS now removed in DataController sitesUpdate) $sites = Site::where('sitecode', 'LIKE', '%RB_%')->get(); foreach ($sites as $site) { $site->series = Series::where('sitecode', '=', $site->sitecode)->get(); } return view('pages.rbc', compact('sites')); }
/** * Initialize objects that will do the work */ public function __construct() { $keyword = Site::getInstance()->getSubdomain(); $twitterScreenName = Site::getInstance()->getTwitterScreenName(); $scraperObj = false; if ($keyword == 'nba') { $scraperObj = new Scraper($keyword); } $this->socialMediaObj = new SocialMedia($keyword, 'twitter', $scraperObj); $this->twitterAdapter = new TwitterAdapter($twitterScreenName); }
public function statitics() { $sites = Site::all(); $cats = Category::all(); $districts = District::all(); $cats_total = 0; foreach ($cats as $cat_id => $cat_name) { $cats_total += Site::where('cat_id', '=', $cat_id)->count(); } return view('pages.statitics', compact(['sites', 'cats', 'districts', 'cats_total'])); }
public function getGenerateManual($role_name = NULL) { $permission_array = \Login::get_role_permissions($role_name); $array = ['role_name' => $role_name]; $array['title'] = 'Manual de Administrador'; $array['site'] = \App\Site::find(1); $array['nodes'] = \App\Node::whereNull('parent_id')->whereIn('permission', $permission_array)->with('fields', 'children.fields', 'children.children.fields')->get(); $pdf = \PDF::loadView('pdf.manual', $array); $header = \View::make('pdf.header', $array); return $pdf->setPaper('letter')->setOption('header-html', $header->render())->stream(trans('admin.manual') . '_' . date('Y-m-d') . '.pdf'); }
public function __construct() { $keyword = Site::getInstance()->getSubdomain(); $instagramScreenName = Site::getInstance()->getInstagramScreenName(); $instagramAccessToken = env("AK_INSTAGRAM_ACCESS_TOKEN"); $scrapeObj = false; if ($keyword == 'nba') { $scrapeObj = new Scraper($keyword); } $this->socialMediaObj = new SocialMedia($keyword, 'instagram', $scrapeObj); $this->instagramAdapter = new InstagramAdapter($instagramScreenName, $instagramAccessToken, $this->socialMediaObj); }
public function pageToCrawl() { $webpage = Webpage::orderBy('crawlcount', 'ASC')->limit(1)->first(); if ($webpage) { $url = $webpage->url; $siteId = $webpage->site_id; } else { $site = Site::all()->random(); $url = $site->url; $siteId = $site->id; } return compact('url', 'siteId'); }
/** * Authorize the upload action of a picture album * see the route list for details * * @param $model * @param $model_id * @param $id * * @return bool */ private function _authorize($model, $model_id, $id) { switch ($model) { case 'user': if ($id != 'new') { $this->album = Album::where('id', $id)->first(); session(['album_id' => null]); } else { if (session('album_id') && session('album_id') != null) { $this->album = Album::where('id', session('album_id'))->first(); } else { $this->makeNewAlbum(); Auth::user()->albums()->save($this->album); $this->album->update(['user_id' => Auth::id()]); } } break; case 'article': $this->article = Article::whereId($id)->first(); if (!($this->album = Album::where('albumable_id', $id)->get()->first())) { $this->makeNewAlbum(); $this->article->albums()->save($this->album); } break; case 'profession': $this->profession = Profession::whereId($id)->first(); if (!($this->album = Album::where('albumable_id', $id)->get()->first())) { $this->makeNewAlbum(); $this->profession->albums()->save($this->album); } break; case 'site': $this->site = Site::whereId($model_id)->first(); if (!($this->album = Album::where('id', $id)->first())) { if (!$this->site->albums->last()) { $this->makeNewAlbum(); $this->site->albums()->save($this->site); } } break; case 'classified': $this->classified = Classified::whereId($id)->first(); if (!($this->classified = Album::where('albumable_id', $id)->get()->first())) { $this->makeNewAlbum(); $this->classified->albums()->save($this->album); } break; } //session(['album_id' => $this->album->id]); return true; }
/** * Execute the console command. * * @return mixed */ public function fire() { // Retrieve the path $csv_path = $this->argument('csv'); $file = file($csv_path); $dry_run = $this->option('dry'); $domains = array_map('str_getcsv', $file); if ($dry_run) { $this->warn('Running on dry-mode'); } $success = 0; foreach ($domains as $domain) { // Set the time $date = strtotime($domain[1]); if ($date === false) { $date = time(); } $date = date('Y-m-d H:i:s', $date); // Set the domain $domain = strtolower($domain[0]); // Domain already exists, skip. if (Site::where('url', '=', $domain)->first() != null) { $this->error(" * " . $domain . " already exists. Skipping."); continue; } $new_site = new Site(); $new_site->url = $domain; $new_site->setCreatedAt($date); if ($dry_run) { $this->info(" * Should add " . $domain . " at " . $date . "."); } else { $this->info(" * Added add " . $domain . " at " . $date . "."); $new_site->save(); } $success++; } $this->info("\nDone! Added {$success} new sites"); }
public static function getAllSites() { if (Cache::has('site-list')) { return Cache::get('site-list'); } $site_list = Site::all(['url']); $site_array = []; // Make sure we're only returning the hostname foreach ($site_list as $site) { $site_array[] = $site->url; } Cache::put('site-list', $site_array, 15); return $site_array; }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DomainController::truncate(); Trust::truncate(); Site::truncate(); Role::truncate(); Permission::truncate(); Module::truncate(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); Model::unguard(); $this->call('DomainControllersTableSeeder'); $this->call('TrustsTableSeeder'); $this->call('SitesTableSeeder'); $this->call('RolesTableSeeder'); $this->call('ModulesTableSeeder'); $this->call('PermissionsTableSeeder'); }
function renderCategoryPath($catPathArr, $route = '/socialmedia/') { $nameShort = Site::getInstance()->getNameShort(); echo "<a class='catPath' href='" . url() . "/socialmedia"; if (Site::getCategoryDepth() < 3) { echo '/all'; } echo "'>" . $nameShort . "</a> » "; if (count($catPathArr) > 0) { foreach ($catPathArr as $key => $obj) { if ($key > 0) { echo " » "; } echo "<a class='catPath' href='" . $route . $obj->slug . "'>" . $obj->display_name . "</a>"; } echo "<br>"; } else { echo "<br>"; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Site $site) { if ($site->delete()) { return $this->respondSuccess('Site Deleted'); } }
public function sites($id) { $user = User::findOrFail($id); $userSites = array(); foreach ($user->sites as $site) { $userSites[] = $site->id; } $sites = array(); foreach (Site::orderBy('name')->get()->toArray() as $pointer) { $sites[$pointer['id']] = $pointer['name']; } return view('pages.users.sites', compact('user', 'sites', 'userSites', 'id')); }
/** * Determine if children of parents are to be retrieved * * @param array $catPathArr * @param string $slug * @param object $catObj * @return boolean */ private function getChildrenBool($catPathArr, $slug, $catObj) { $getChildren = false; if (Site::getCategoryDepth() == 2 && $slug != 'all') { // if it is just a collection of parents without children (and we're not getting 'all'), // treat parent as child and use child layout $getChildren = true; } else { // Check to see if we're getting children - members within single category // or parent - members within groups of categories // eg. parent = members within groups of categories = members of the NBA Pacific div and the teams they're // on eg. children = members within single category = members (Blake Griffin et al) of the category Clippers // Members in single category gets all members displayed unconcealed on page // Members in groups of categories get members concealed and navigable within categories on page foreach ($catPathArr as $obj) { if ($obj->child_id == $catObj->id && $obj->parent_id > 0) { $getChildren = true; break; } } } return $getChildren; }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $site = Site::findOrFail($id); dd($site); }
<?php use App\Site; ?> @extends('app') @section('content') <?php if (true) { ?> <a href='http://<?php echo Site::getInstance()->getDomain(); ?> /login/facebook'>Login with Facebook</a> <?php } else { ?> <div class="container-fluid"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading">Login</div> <div class="panel-body"> @if (count($errors) > 0) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error)
<?php use App\Site; $site = Site::getInstance(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> <?php if ($site::getSubdomain() == 'abbotkinneyblvd') { echo 'AbbotKinneyBl.com - what\'s coming up and going down on Abbot Kinney Blvd.'; } else { echo $site::getPageTitle(); } ?> </title> <link href="/css/app.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <!-- bootstrap --> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <!-- Optional theme --> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <!-- Latest compiled and minified JavaScript --> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $labor = Labor::where('employee_no', '=', $id)->first(); $trades = Trade::all()->lists('name', 'id')->toArray(); $sites = Site::all()->lists('code', 'id')->toArray(); //dd($trades); return view('pages.edit_labor', compact('labor', 'sites', 'trades')); }