/** * Display a listing of the resource. * * @return Response */ public function index() { Date::setLocale('th'); $user = Auth::user(); $jobapps = Jobapp::all(); return view('hr.jobapps.index', compact('jobapps', 'user')); }
public function home() { $page_title = "لوحة التحكم"; $section_title = "لوحة التحكم"; Date::setLocale('ar'); $date = Date::now()->format('j F Y'); $day = Date::now()->format('l'); $month = Date::now()->format('F'); $year = Date::now()->format('Y'); //**************Tasks*************** $tasksToday = Task::orderBy('task_date', 'desc')->today()->take(5); $tasksWeek = Task::orderBy('task_date', 'desc')->thisweek()->take(5); $tasksMonth = Task::orderBy('task_date', 'desc')->thisMonth()->take(5); $tasks_count = count($tasksToday->toArray()); //**************Fails*************** $failsToday = Failure::orderBy('fail_time', 'desc')->today()->take(5); $failsWeek = Failure::orderBy('fail_time', 'desc')->thisweek()->take(5); $failsMonth = Failure::orderBy('fail_time', 'desc')->thisMonth()->take(5); $fails_count = count($failsToday->toArray()); //**************Repairs*************** $repairsToday = Repair::today(); $repairsWeek = Repair::thisweek(); $repairsMonth = Repair::thisMonth(); $repairs_count = count($repairsToday->toArray()); return view('dashboard.dashboard', compact('page_title', 'section_title', 'date', 'day', 'month', 'year', 'tasksToday', 'tasksMonth', 'tasksWeek', 'tasks_count', 'failsToday', 'failsMonth', 'failsWeek', 'fails_count', 'repairsToday', 'repairsMonth', 'repairsWeek', 'repairs_count')); }
public function getHome() { Date::setLocale('id'); $date = Date::now(); $pikets = \DB::table('t_piket')->where('hari', $date->format('l'))->first(); $piket = \DB::table('t_guru')->where('kd_guru', $pikets->kd_guru)->first(); $jam_masuk = Date::createFromFormat('H:i:s', $pikets->jam_masuk, Date::now()->tzName)->toTimeString(); return view('home', compact('jam_masuk')); }
/** * Display a listing of the resource. * * @return Response */ public function home() { $lastNews = News::orderBy('id', 'desc')->first(); $lastNews->description = $this::text_humanized($lastNews->description); Date::setLocale('fr'); $date = new Date($lastNews->when); $lastNews->when = $date->format('l j F Y'); $lastNews->hour = $date->format('H:i'); return view('page/home', ['news' => $lastNews]); }
public function build() { $translator = $this->processor->getTranslator(); $html = ""; Date::setLocale($this->locale); if ($this->printStyles) { $html .= $this->getStylesHtml(); } $hidden = $this->isModal ? ' style="display:none;"' : ''; if ($this->printFrame) { $html .= '<div id="changemodal-wrapper"' . $hidden . '><div id="changemodal"' . $hidden . '><div id="changemodal-frame"><h1>' . $this->title . '</h1>'; if ($this->isModal) { $html .= '<i id="close-button" class="fa fa-times"></i>'; } } else { $html .= '<div id="changemodal">'; } $html .= '<div class="changelog">'; try { foreach ($this->processor->getVersions() as $version) { $html .= '<h2 id="' . $version->getVersion() . '"'; if ($version->isYanked()) { $html .= ' class="yanked" title="' . $translator->translateTo('This release has been yanked.') . '"'; } $html .= '>' . $version->getVersion() . '</h2>'; if ($version->isReleased() && $version->getReleaseDate() !== null) { $date = new Date($version->getReleaseDate()->getTimestamp()); $html .= '<h3 title="' . '">' . $date->ago(); if ($this->printDownloadLinks && !$version->isYanked()) { $html .= ' <a href="' . $version->getUrl() . '" target="_blank"><i class="fa fa-download"></i></a>'; } $html .= '</h3>'; } $html .= '<div class="version-wrapper">'; foreach ($version->getChanges() as $label => $changes) { $html .= '<ul class="' . $label . '">'; foreach ($changes as $change) { $html .= '<li data-label="' . ucfirst($translator->translateTo($label)) . '">' . $change . '</li>'; } $html .= '</ul>'; } $html .= '</div>'; } } catch (\Exception $e) { $html .= '<div class="alert alert-danger" style="text-align: center" role="alert">' . '<i class="fa fa-lg fa-exclamation-triangle"></i><br>' . '<b>Could not get Changelog!</b><br>' . 'Error: <em>' . $e->getMessage() . '</em>' . '</div>'; } $html .= '</div></div>'; if ($this->printFrame) { $html .= '</div>'; } if ($this->printScripts) { $html .= $this->getScriptsHtml(); } return $html; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $categories = ForumCategories::all(); $categorie = ForumCategories::where('slug', $id)->first(); foreach ($categorie->subjects as $subject) { Date::setLocale('fr'); $date = new Date($subject->created); $subject->when = $date->format('j F Y'); } return view('forum.categorie.show', ['categorie' => $categorie]); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $sujet = ForumSubjects::where("id", $id)->first(); $categorie = ForumCategories::find($sujet->category); foreach ($sujet->messages as $message) { Date::setLocale('fr'); $date = new Date($message->created); $message->when = $date->format('j F Y'); $message->message = $this::text_humanized($message->message); $message->message = BBCode::parse($message->message); } return view('forum.sujets.show', ['categorie' => $categorie, "sujet" => $sujet]); }
public function getSnippets() { $posts = Post::orderBy('created_at', 'desc')->take(self::NUMBER_OF_SNIPPETS)->get(); foreach ($posts as $post) { $post->body = self::shorten_string($post->body, 40); Date::setLocale('de'); $dt = new Date("" . $post->created_at . ""); $dt = $dt->format('j F Y'); $post->loc_date = $dt; $post->url = implode("-", explode(" ", $post->title)); } return view('blog/index', ['posts' => $posts]); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { $supportedLanguages = $request->getLanguages(); $userLanguage = $this->config->get('app.locale'); foreach ($supportedLanguages as $language) { $language = str_replace('_', '-', $language); if (isset($this->langs[$language])) { $userLanguage = $language; break; } } app('translator')->setLocale($userLanguage); Date::setLocale($userLanguage); return $next($request); }
public function getHome() { if (Auth::check() && Auth::getUser()->getAttribute('admin') == 1) { return redirect('admin'); } else { Date::setLocale('id'); $user = Auth::getUser(); $pewangi = \DB::table('pewangi')->select('nama')->get(); $arrPewangi = array(); foreach ($pewangi as $p) { $arrPewangi[$p->nama] = $p->nama; } return view('home', compact('user', 'arrPewangi')); } }
public function testTranslatesDays() { $days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); foreach ($this->languages as $language) { $translations = (include "src/lang/{$language}/date.php"); foreach ($days as $day) { $date = new Date($day); $date->setLocale($language); $this->assertTrue(isset($translations[$day])); $this->assertEquals($translations[$day], $date->format('l'), "Language: {$language}"); // Full $this->assertEquals(substr($translations[$day], 0, 3), $date->format('D'), "Language: {$language}"); // Short } } }
/** * Return a timestamp as DateTime object. * * @param mixed $value * @return \Carbon\Carbon */ protected function asDateTime($value) { Date::setLocale('it'); // If the value is already a DateTime instance, we will just skip the rest of // these checks since they will be a waste of time, and hinder performance // when checking the field. We will just return the DateTime right away. if ($value instanceof DateTime) { // } elseif (is_numeric($value)) { return Date::createFromTimestamp($value); } elseif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $value)) { return Date::createFromFormat('Y-m-d', $value)->startOfDay(); } elseif (!$value instanceof DateTime) { $format = $this->getDateFormat(); return Date::createFromFormat($format, $value); } return Date::instance($value); }
/** * Boot the service provider. * * @return void */ public function boot() { $env = $this->app->environment(); $repo = $this->app->make(Repository::class); $cache = $this->app->make(Cache::class); $loaded = $cache->load($env); $this->app->terminating(function () use($repo, $cache) { if ($repo->stale()) { $cache->clear(); } }); try { if ($loaded === false) { $loaded = $repo->all(); $cache->store($env, $loaded); } $settings = array_merge($this->app->config->get('setting'), $loaded); $this->app->config->set('setting', $settings); } catch (Exception $e) { // } if ($appDomain = $this->app->config->get('setting.app_domain')) { $this->app->config->set('app.url', $appDomain); } if ($appLocale = $this->app->config->get('setting.app_locale')) { $this->app->config->set('app.locale', $appLocale); $this->app->translator->setLocale($appLocale); Date::setLocale($appLocale); } if ($appTimezone = $this->app->config->get('setting.app_timezone')) { $this->app->config->set('cachet.timezone', $appTimezone); } $allowedOrigins = $this->app->config->get('cors.defaults.allowedOrigins'); if ($allowedDomains = $this->app->config->get('setting.allowed_domains')) { $domains = explode(',', $allowedDomains); foreach ($domains as $domain) { $allowedOrigins[] = $domain; } } else { $allowedOrigins[] = $this->app->config->get('app.url'); } $this->app->config->set('cors.paths.api/v1/*.allowedOrigins', $allowedOrigins); }
public function setup() { Date::setLocale('ru'); }
public function init() { Date::setLocale('ru'); $this->_initServiceLocator(); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $locale = $this->app->getLocale(); Date::setLocale($locale); }
/** * Set the locale. * */ protected function setLocale() { $locale = $this->app['translator']->getLocale(); Date::setLocale($locale); }
function get_date_year($input) { Date::setLocale('th'); $create_date = new Date($input); return $create_date->add('543 years')->format('Y'); }
public function getUsers(Request $request) { Date::setLocale('th'); $records = []; $records["data"] = []; $filters = []; if ($request->input('customActionType') && $request->input('customActionType') == "group_action" && $request->input('customActionName') == "delete") { if (count($request->input('id')) > 0) { $deleted = DB::table('TBL_PRIVILEGE')->whereIn('USER_PRIVILEGE_ID', $request->input('id'))->delete(); if ($deleted) { $records["customActionStatus"] = "OK"; $records["customActionMessage"] = "ลบข้อมูลผู้ใช้เรียบร้อยแล้ว"; } else { $records["customActionStatus"] = "Errors"; $records["customActionMessage"] = "ไม่สามารถลบข้อมูลผู้ใช้ได้"; } } } $query = DB::table('TBL_USER')->select('TBL_USER.EMP_ID', 'TBL_EMPLOYEE_INFO.FULL_NAME', 'TBL_USER.USERNAME', 'TBL_USER.USER_STATUS_ID', 'TBL_USER_STATUS.STATUS_DESC', 'TBL_USER.USER_PRIVILEGE_ID', 'TBL_PRIVILEGE.USER_PRIVILEGE_DESC', 'TBL_USER.EMAIL', 'TBL_USER.PHONE', 'TBL_USER.CREATE_DATE', 'TBL_USER.LAST_MODIFY_DATE')->leftJoin('TBL_EMPLOYEE_INFO', 'TBL_USER.EMP_ID', '=', 'TBL_EMPLOYEE_INFO.EMP_ID')->leftJoin('TBL_PRIVILEGE', 'TBL_PRIVILEGE.USER_PRIVILEGE_ID', '=', 'TBL_USER.USER_PRIVILEGE_ID')->leftJoin('TBL_USER_STATUS', 'TBL_USER_STATUS.USER_STATUS_ID', '=', 'TBL_USER.USER_STATUS_ID'); if (!empty($request->input('user_id'))) { $filters = ['TBL_USER.EMP_ID', $request->input('user_id')]; } if (!empty($request->input('full_name'))) { $filters = ['TBL_EMPLOYEE_INFO.FULL_NAME', 'like', $request->input('full_name') . '%']; } if ($request->input('user_group') != "") { $filters = ['TBL_USER.USER_PRIVILEGE_ID', $request->input('user_group')]; } if (!empty($request->input('email'))) { $filters = ['TBL_USER.EMAIL', 'like', $request->input('email') . '%']; } if (!empty($request->input('phone'))) { $filters = ['TBL_USER.PHONE', 'like', $request->input('phone') . '%']; } if ($filters) { $query->where([$filters]); } $total = $query->count(); $limit = intval($request->input('length')); $limit = $limit < 0 ? $limit : $limit; $iDisplayStart = intval($request->input('start')); $sEcho = intval($request->input('draw')); $order = $request->input('order'); $orderColumns = [1 => 'TBL_USER.EMP_ID', 2 => 'TBL_EMPLOYEE_INFO.FULL_NAME', 3 => 'TBL_USER.USERNAME', 4 => 'TBL_USER_STATUS.STATUS_DESC', 5 => 'TBL_PRIVILEGE.USER_PRIVILEGE_DESC', 6 => 'TBL_USER.EMAIL', 7 => 'TBL_USER.PHONE', 8 => 'TBL_USER.CREATE_DATE', 9 => 'TBL_USER.LAST_MODIFY_DATE']; if ($order) { $query->orderBy($orderColumns[$order[0]['column']], $order[0]['dir']); } else { $query->orderBy('TBL_USER.EMP_ID', 'desc'); } $users = $query->skip($iDisplayStart)->take($limit)->get(); if ($users) { foreach ($users as $user) { $create_date_str = ''; if ($user->CREATE_DATE) { $create_date = new Date($user->CREATE_DATE); $create_date_str = $create_date->add('543 years')->format('d M Y H:i:s'); } $last_modify_date_str = ''; if ($user->LAST_MODIFY_DATE) { $last_modify_date = new Date($user->LAST_MODIFY_DATE); $last_modify_date_str = $last_modify_date->add('543 years')->format('d M Y H:i:s'); } $records["data"][] = [sprintf('<input type="checkbox" name="id[]" value="%1$s">', $user->EMP_ID), $user->EMP_ID, $user->FULL_NAME, $user->USERNAME, $user->STATUS_DESC, $user->USER_PRIVILEGE_DESC, $user->EMAIL, $user->PHONE, $create_date_str, $last_modify_date_str, sprintf('<a href="%1$s" target="_blank" class="btn btn-sm btn-outline grey-salsa"><i class="fa fa-pencil"></i> แก้ไข</a><a data-toggle="modal" href="#deleteUserGroup" data-group_name="%2$s" data-group_id="%3$s" class="btn btn-sm btn-outline red-thunderbird row-user-group-%4$s"><i class="fa fa-remove"></i> ลบ</a>', action('UserGroupController@getEditUserGroup', $user->EMP_ID), $user->EMP_ID, $user->EMP_ID, $user->EMP_ID)]; } } $records["draw"] = $sEcho; $records["recordsTotal"] = $total; $records["recordsFiltered"] = $total; return response()->json($records); }
public static function formatHumanTime($timestamp) { Date::setLocale('vi'); $date = new Date((int) $timestamp); return $date->ago(); }
/** * @method __construct */ function __construct() { Date::setLocale('pt_BR'); $this->rss = simplexml_load_file('http://g1.globo.com/dynamo/economia/rss2.xml'); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $locale = $this->app['translator']->getLocale(); Date::setLocale($locale); }
@extends( 'musica.template-musica') @section('nivel2', '<li class="active"><a href="/musica/evento">Eventos</a></li>') @section('nivel3', '<li class="active">Remover Evento</li>') <?php use Jenssegers\Date\Date; Date::setLocale('pt_BR'); ?> @section('content') <div class="text-center bigtext1 alert alert-warning alert-important"> Tem certeza que deseja excluir o evento <span class="destaque">"{{$evento->titulo}}"</span>? </div> <hr/> <div class="row text-center"> <div class="col-md-2 text-right destaque">Título do Evento:</div> <div class="col-md-8 text-left">{{$evento->titulo}}</div> </div> <div class="row text-center"> <div class="col-md-2 text-right destaque">Data do Evento:</div> <div class="col-md-8 text-left"> <?php echo Date::parse($evento->hora)->format('l, j \\d\\e F \\d\\e Y \\à\\s H\\hi'); ?> ({{ $evento->hora->diffForHumans()}}) </div> </div>
private function makeTimelineData($timeline) { Carbon::setLocale('pt_BR'); foreach ($timeline as $key => $item) { $now = Carbon::now(); $start = Carbon::createFromFormat('Y-m-d H:i:s', $item['start']); $end = Carbon::createFromFormat('Y-m-d H:i:s', $item['end']); $startW3c = Carbon::createFromFormat('Y-m-d H:i:s', $item['start'])->addSeconds(env('TIME_OFFSET_ADD')); $endW3c = Carbon::createFromFormat('Y-m-d H:i:s', $item['end'])->addSeconds(env('TIME_OFFSET_ADD')); $timeline[$key]['startW3c'] = $startW3c->toW3cString(); $timeline[$key]['endW3c'] = $endW3c->toW3cString(); $end->addSeconds(2); $diff = $start->diffInDays($end); if ($diff <= 1) { $period = $start->format('d \\d\\e F'); } else { if ($start->month == $end->month) { $period = $start->format('d') . ' a ' . $end->format('d \\d\\e F'); } else { $period = $start->format('d \\d\\e F') . ' a ' . $end->format('d \\d\\e F'); } } $timeline[$key]['period'] = $period; $timeline[$key]['past'] = $start->diffInSeconds($now) > 0; } return ['lines' => $timeline, 'now' => $now->toW3cString()]; }
public function testTimespanTranslated() { Date::setLocale('nl'); $date = new Date(1403619368); $date = $date->sub('-100 days -3 hours -20 minutes'); $this->assertSame("3 maanden, 1 week, 1 dag, 3 uur, 20 minuten", $date->timespan(1403619368)); }
public function __construct() { $this->middleware('auth'); Date::setLocale('nl'); }
/** * Return model in Datatable ajax | Also search by ajax. * * @return mixed */ public function getData() { $model = $this->crud['model']; $columns = $this->crud['columns']; //Check if has a pivot column $pivots = array_pluck($this->crud['columns'], ['pivot']); $isPivot = array_search('true', $pivots); if ($isPivot != false) { $pivotField = $this->crud['columns'][$isPivot]; // dd($pivotField); $data = $model::select('*')->get(); //dd($columns); } else { $data = $model::select('*')->get(); } $datatable = Datatables::of($data); foreach ($columns as $column) { if (isset($column['type']) && $column['type'] == 'select_multiple') { $datatable->addColumn($column['name'], '')->editColumn($column['name'], function ($columnInfo) use($column) { $results = $columnInfo->{$column['entity']}()->getResults(); $html = '-'; if ($results && $results->count()) { $results_array = $results->lists($column['attribute'], 'id'); $html = implode(', ', $results_array->toArray()); } return $html; }); } elseif (isset($column['type']) && $column['type'] == 'select') { $datatable->addColumn($column['name'], '')->editColumn($column['name'], function ($columnInfo) use($column) { $html = '-'; if ($columnInfo->{$column['entity']}()->getResults()) { $html = $columnInfo->{$column['entity']}()->getResults()->{$column['attribute']}; } return $html; }); } elseif (isset($column['type']) && $column['type'] == 'model_function') { $datatable->addColumn($column['name'], '')->editColumn($column['name'], function ($columnInfo) use($column) { return $columnInfo->{$column['function_name']}(); }); } elseif (isset($column['type']) && $column['type'] == 'image') { $datatable->addColumn($column['name'], '')->editColumn($column['name'], function ($columnInfo) use($column) { return "<img src='" . asset($columnInfo->{$column['name']}) . "' width='50%' />"; }); } elseif (isset($column['type']) && $column['type'] == 'browse') { $datatable->addColumn($column['name'], '')->editColumn($column['name'], function ($columnInfo) use($column) { if (isset($column['browse']) && $column['browse'] != 'image') { return $columnInfo->content; } return "<img src='" . asset($columnInfo->{$column['name']}) . "' width='50%' />"; }); } elseif (isset($column['type']) && isset($column['pivot']) && $column['pivot'] == true) { $datatable->editColumn($column['name'], function ($columnInfo) use($column) { // dd($columnInfo); // dd($column); //["model"] $pivotModel = $this->crud['model']; $dataPivot = $column['model']::find($columnInfo[$column['entity']]); if ($dataPivot) { return $dataPivot->{$column}['attribute']; } }); } elseif (isset($column['type']) && $column['type'] == 'date') { $datatable->addColumn($column['name'], '')->editColumn($column['name'], function ($columnInfo) use($column) { if ($columnInfo->{$column['name']} != null) { $locale = isset($column['language']) ? $column['language'] : 'en'; $format = isset($column['format']) ? $column['format'] : 'Y-m-d'; Date::setLocale($locale); $date = Date::parse($columnInfo->{$column['name']}); return $date->format($format); } return ''; }); } else { if (array_search('content', $columns)) { $datatable->editColumn($column['name'], function ($columnInfo) use($column) { return strip_tags(Str::words($columnInfo->content, 50, '...')); }); } else { $datatable->editColumn($column['name'], function ($columnInfo) use($column) { if (trim($columnInfo->{$column['name']}) == '') { if (isset($this->crud['is_translate']) && $this->crud['is_translate'] == true) { if ($columnInfo->translate()) { $columnInfo->{$column['name']} = $columnInfo->{$column['name']}; } } } return str_limit(strip_tags($columnInfo->{$column['name']}), 80, '[...]'); }); } } } if (!(isset($crud['edit_permission']) && $crud['edit_permission'] === false && isset($crud['delete_permission']) && $crud['delete_permission'] === false)) { $datatable->addColumn('actions', '')->editColumn('actions', function ($column) { $html = ''; if (!(isset($crud['edit_permission']) && !$crud['edit_permission'])) { $html .= '<a href="' . url($this->crud['route']) . '/' . $column->id . '/edit" class="btn btn-xs btn-complete "><i class="fa fa-edit p-r-10"></i>' . _(trans('crud.edit')) . '</a>'; } if (!(isset($crud['delete_permission']) && !$crud['delete_permission'])) { $html .= '<a href="' . url($this->crud['route']) . '/' . $column->id . '" class="btn btn-xs btn-danger m-l-5" data-button-type="delete"><i class="fa fa-trash p-r-10 "></i>' . _(trans('crud.delete')) . '</a>'; } return $html; }); } return $datatable->make(true); }