예제 #1
0
 public function __construct()
 {
     $this->middleware('ipblocked');
     $driver = config('database.default');
     $database = config('database.connections');
     $this->db = $database[$driver]['database'];
     $this->dbuser = $database[$driver]['username'];
     $this->dbpass = $database[$driver]['password'];
     $this->dbhost = $database[$driver]['host'];
     if (\Auth::check() == true) {
         if (!\Session::get('gid')) {
             \Session::put('uid', \Auth::user()->id);
             \Session::put('gid', \Auth::user()->group_id);
             \Session::put('eid', \Auth::user()->email);
             \Session::put('ll', \Auth::user()->last_login);
             \Session::put('fid', \Auth::user()->first_name . ' ' . \Auth::user()->last_name);
             \Session::put('themes', 'sximo-light-blue');
         }
     }
     if (!\Session::get('themes')) {
         \Session::put('themes', 'sximo');
     }
     if (defined('CNF_MULTILANG') && CNF_MULTILANG == 1) {
         $lang = \Session::get('lang') != "" ? \Session::get('lang') : CNF_LANG;
         \App::setLocale($lang);
     }
     $data = array('last_activity' => strtotime(Carbon::now()));
     \DB::table('tb_users')->where('id', \Session::get('uid'))->update($data);
 }
예제 #2
0
 public function feedback()
 {
     \App::setLocale(Auth::user()->language());
     $user = Auth::user();
     $propositionFactory = new PropositionFactory();
     $viewUser = ['fullName' => $user->firstName() . " " . $user->lastName(), 'firstName' => $user->firstName(), 'lastName' => $user->lastName(), 'contactEmail' => $user->contactEmail(), 'email' => $user->email(), 'avatar' => $user->avatar(), 'belongsToSchool' => $user->belongsToSchool(), 'schoolEmail' => $user->googleEmail(), 'role' => $user->role(), 'propositionsCount' => $propositionFactory->getPropositionsCountByUser($user->userId())];
     return view('feedback', ['fullName' => $user->firstName() . " " . $user->lastName(), 'user' => $viewUser]);
 }
 public function setLocale($language)
 {
     //Change language
     \Session::set('locale', $language);
     \App::setLocale($language);
     \Lang::setLocale($language);
     //
     return \Redirect::back();
 }
예제 #4
0
 public function __construct()
 {
     $lang = Session::get('locale');
     if ($lang != null) {
         \App::setLocale($lang);
     }
     // $data = [];
     $styles = Style::all();
     Session::put('footerStyle', $styles);
     // view()->share('footerStyle', $styles);
 }
예제 #5
0
 /**
  * Function create construct
  */
 public function __construct()
 {
     $language = Language::where('is_default', '=', 1)->first();
     if ($language == null) {
         \App::setLocale('en');
     } else {
         \App::setLocale($language->code);
     }
     $this->getFeatureGroup();
     $d = $this->sidebar();
     $this->getNotification();
     view()->share('format_date', \App\Configure::where('name', '=', 'format_date')->first()->value);
 }
 public function showPage($localeCode, $slug)
 {
     // ローカルが存在しているか確認
     $locale = Locale::where('code', $localeCode)->first();
     if ($locale == null) {
         abort(404);
     }
     // 言語として設定する
     \App::setLocale($localeCode);
     // ローカルとスラグでポストが存在しているか確認
     $post = Post::with('locale')->where('slug', $slug)->where('locale_id', $locale->id)->first();
     if ($post == null) {
         abort(404);
     }
     // 記事が存在しているのでビューに渡す
     return view('page')->with('post', $post);
 }
예제 #7
0
파일: Controller.php 프로젝트: sidis405/ibi
 function __construct()
 {
     $pagine_repo = new PagineRepo();
     $contenuti_footer = $pagine_repo->getContentForPage('index');
     view()->share('contenuti_footer', $contenuti_footer);
     view()->share('user', \Auth()->user());
     if (\Auth::user()) {
         view()->share('user_role', array_pluck(\Auth::user()->roles()->get(), 'name')[0]);
     }
     view()->share('menu', MenuItems::all()->keyBy('slug'));
     if (Session::has('locale')) {
         $locale = Session::get('locale');
     } else {
         $locale = 'it';
     }
     \App::setLocale($locale);
     Session::put('locale', $locale);
     // dd(\App::getLocale($locale));
     view()->share('text', Config::get('traduzioni.' . $locale));
     Session::put('currentPage', '');
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function __construct()
 {
     \App::setLocale(Auth::user()->language());
 }
예제 #9
0
 public function test(Request $request)
 {
     $this->validate($request, ['name_card' => 'required']);
     App::setLocale('vi');
     return 'ok';
 }
 public function search(Request $request)
 {
     \App::setLocale(Auth::user()->language());
     $user = Auth::user();
     $viewUser = ['fullName' => $user->firstName() . " " . $user->lastName(), 'firstName' => $user->firstName(), 'lastName' => $user->lastName(), 'contactEmail' => $user->contactEmail(), 'email' => $user->email(), 'avatar' => $user->avatar(), 'belongsToSchool' => $user->belongsToSchool(), 'belongsToSchool' => $user->belongsToSchool(), 'schoolEmail' => $user->googleEmail(), 'role' => $user->role()];
     $results = array();
     $pages = null;
     if (empty($request->input('q')) == false) {
         $term = $request->input('q');
         $propositionFactory = new PropositionFactory();
         $proposition_results = $propositionFactory->search($term, 5);
         $pages = $proposition_results->lastPage();
         foreach ($proposition_results->items() as $proposition) {
             $proposer = with(new userFactory())->getUser($proposition->proposerId());
             $results[$proposition->propositionId()] = ['id' => $proposition->propositionId(), 'propositionSort' => $proposition->propositionSort(), 'proposer' => ['id' => $proposition->proposerId(), 'fullName' => $proposer->firstName() . " " . $proposer->lastName(), 'avatar' => $proposer->avatar()], 'propositionCreationDate' => $proposition->date_created(), 'deadline' => $proposition->deadline(), 'statusId' => $proposition->status(), 'ending_in' => Carbon::now()->diffInDays(Carbon::createFromTimestamp(strtotime($proposition->deadline())), false), 'upvotes' => $propositionFactory->getUpvotes($proposition->propositionId()), 'downvotes' => $propositionFactory->getDownvotes($proposition->propositionId()), 'comments' => $propositionFactory->getCommentsCount($proposition->propositionId()), 'marker' => $propositionFactory->getMarker($proposition->propositionId())];
         }
     }
     return view('search', ['fullName' => $user->firstName() . " " . $user->lastName(), 'user' => $viewUser, 'results' => $results, 'pages' => $pages]);
 }
 public function __construct()
 {
     \App::setLocale(\Configer::get('lang'));
 }
예제 #12
0
 public function __construct(Socialite $socialite)
 {
     $this->socialite = $socialite;
     \App::setLocale(Auth::user()->language());
 }