/** * 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'); }
/** * 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(); } } } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $sites = Site::all(); $data = json_encode(array('sites' => $sites)); return $data; }
/** * 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'); }
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'])); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { try { $statusCode = 200; $response = ['sites' => Site::all()->toArray()]; } catch (Exception $e) { $statusCode = 400; $response = [];
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'); }
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; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $sites = Site::all(); return View('home.site.index', ['bread' => '我的站点', 'sites' => $sites]); }
/** * 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')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $sites = Site::all(); return view('site.index', compact('sites')); }
/** * Create a new controller instance. * * @return void */ public function __construct() { $this->site = Site::all()->first(); View::share('site', $this->site); }
public function getList() { $sites = Site::all(); $universites = Universite::all(); return view('backoffice.sites', compact("sites", "universites")); }
protected function syncUserSites(User $user) { if ($this->adLDAP->user()->inGroup($user->username, 'Fox_Staff')) { $role = 1; } if ($this->adLDAP->user()->inGroup($user->username, 'Fox_Student')) { $role = 2; } if ($role) { $sites = $user->sites()->get()->lists('id')->all(); $adSites = []; foreach (\App\Site::all() as $uSite) { if ($this->adLDAP->user()->inGroup($user->username, 'Fox_' . strtoupper($uSite->slug))) { array_push($adSites, $uSite->id); } } foreach ($adSites as $adSite) { if (!in_array($adSite, $sites)) { $this->addSiteUser($user->id, $adSite, $role); } } foreach ($sites as $uSite) { if (!in_array($uSite, $adSites)) { $this->removeSiteUser($user->id, $adSite, $role); } } } }
public function sites() { $sites = Site::all(); return view('data.sites', compact('sites')); }
public function getSelectOptions() { $field = \Input::get('field'); if ($field == 'site') { $response = Site::all()->lists('code', 'code')->toArray(); } else { $response = [1 => "YES", 0 => "NO"]; } echo json_encode($response); }
public function handleEditSiteinfo() { $rules = array('title' => 'required', 'logo' => 'mimes:jpeg,bmp,png', 'terms_conditions' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::action('CommonController@editSiteinfo')->withErrors($validator)->withInput(); } else { $site = Site::all()->first(); if ($site == null) { $site = new Site(); } $site->title = Input::get('title'); $logo_val = Input::file('logo'); if (!empty($logo_val)) { $extension = Input::file('logo')->getClientOriginalExtension(); $imageName = 'logo.' . $extension; Input::file('logo')->move(base_path() . '/public/uploads/site/', $imageName); $site->logo = $imageName; } $site->terms_conditions = html_entity_decode(Input::get('terms_conditions')); $site->save(); return Redirect::action('CommonController@admincontrol'); } }
/** * Search all businesses * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function search() { $sites = Site::all()->sortBy(['name']); $categories = SiteCategory::all()->sortBy(['name']); return view('sites.search', compact('sites', 'categories')); }
if (Auth::check()) { return view('createappointment'); } else { return view('auth/login'); } }); Route::get('visitors/', function () { View::share(array('site' => Site::all()->first(), 'captcha' => (new Captcha())->html())); if (Auth::check()) { return view('visitors'); } else { return view('auth/login'); } }); Route::get('all-admin/', function () { View::share(array('site' => Site::all()->first(), 'captcha' => (new Captcha())->html())); if (Auth::check()) { return view('alladmin'); } else { return view('auth/login'); } }); // API ROUTES ================================== Route::group(array('prefix' => 'api'), function () { Route::resource('welcome', 'CommonController@index'); Route::resource('settings', 'CommonController@settings'); Route::post('settings/update/{userdate}', 'CommonController@updateuser'); Route::post('locations/create', 'LocationController@create'); Route::post('locations/update/{location}', 'LocationController@update'); Route::resource('locations', 'LocationController'); Route::post('visitortypes/create', 'VisitortypeController@create');