public function getMultiple()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     return view('send/multiple');
 }
 public function getRegister()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     return view('admin/register');
 }
Exemple #3
0
 public function view_product()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     return view('backoffice.cart_view_products');
 }
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     if (\Auth::guest()) {
         return redirect()->action('HomeController@index');
     }
     return redirect('auth/login');
 }
Exemple #5
0
 public function registerForm()
 {
     if (!\Auth::guest()) {
         return redirect('/');
     }
     return view('auth.register');
 }
Exemple #6
0
 /**
  * @author LAHAXE Arnaud
  *
  *
  * @return $this|\Illuminate\Http\RedirectResponse|\Laravel\Lumen\Http\Redirector
  */
 public function loginForm()
 {
     if (!\Auth::guest()) {
         return redirect('/');
     }
     return view('auth.login', ['googleOauth' => env('GOOGLE_OAUTH_ENABLED')]);
 }
Exemple #7
0
 public function register()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     return \Auth::user()->name;
     return view('Pages.register');
 }
 public static function header()
 {
     if (\Auth::guest()) {
         $count = null;
     } else {
         $count = FollowController::getCounter(\Auth::user()->name);
     }
     return $count;
 }
 public function __construct()
 {
     dd('sss');
     if (\Auth::guest()) {
         Session::flash('flash_message', 'You need to log in');
         // dd(\Session::all());
         return \Redirect::to('index');
     }
 }
 public function info()
 {
     if (\Auth::guest()) {
         return view('/');
     }
     $id = \Auth::user()->id;
     $languages = \App\languages::all();
     $courses = \App\courses::all();
     return view('info')->with(compact('languages'))->with(compact('courses'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     if (\Auth::check() && \Auth::user()->name === 'admin') {
         return view('admin/main');
     }
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     return view('home');
 }
 /**
  * Update the post in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($id, Requests\PhotosRequest $request)
 {
     if (\Auth::guest()) {
         return redirect('/');
     }
     $photo = \App\Photo::findorFail($id);
     $photo->update($request->all());
     session()->flash('flash_message', 'Photo Successfully Saved!');
     return redirect('photos/' . $photo->blog_id . '');
 }
Exemple #13
0
 public function update($id, ArticleRequest $request)
 {
     if (\Auth::guest()) {
         return redirect('article');
     }
     $article = Article::findOrFail($id);
     $article['updated_at'] = Carbon::now('Asia/Shanghai');
     $article->update($request->all());
     return redirect('article');
 }
 public function show(Article $article)
 {
     if (!$article->is_visible and \Auth::guest()) {
         return abort(403);
     }
     if (\Auth::check() and !is_admin_role(\Auth::user())) {
         if (!$article->is_visible and !\Auth::user()->owns($article)) {
             return abort(403);
         }
     }
     return view('article.show', compact('article'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $greet = '';
     $submission = null;
     if (\Auth::check()) {
         $user = \Auth::user();
         $greet = $this->setGreeting($user);
         $submission = Submission::where('facebook_id', $user->facebook_id)->first();
     } else {
         $user = \Auth::guest();
     }
     return view('index')->with('user', $user)->with('greeting', $greet)->with('submission', $submission);
 }
Exemple #16
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id which is the id of the conversation
  * @return Response
  */
 public function show($id)
 {
     $admin = Role::select('id')->where('description', '=', 'admin')->firstOrFail();
     // if we are admin we want to see everything
     if (\Auth::id() == $admin->id) {
         $listofMessages = User::select("*")->Join('threads', 'threads.user_id', '=', 'users.id')->where("threads.conversation_id", '=', $id)->get();
     } else {
         // we are not admin but we want to see published messages and the status of our posted messages
         if (\Auth::guest()) {
             $listofMessages = User::select("*")->Join('threads', 'threads.user_id', '=', 'users.id')->where("threads.conversation_id", '=', $id)->where('threads.Pending', '=', 0)->get();
         } else {
             $listofMessages = User::select("*")->Join('threads', 'threads.user_id', '=', 'users.id')->where("threads.conversation_id", '=', $id)->where('threads.Pending', '=', 0)->orwhere('threads.user_id', '=', \Auth::id())->get();
         }
     }
     // We want the list of message related to this conversation with their writers
     //$listofMessages= Thread::select("*")->Join('users', 'Threads.user_id', '=', 'users.id')->where("threads.conversation_id",'=',$id)->get();
     return view('Thread')->with(['lstOfMessages' => $listofMessages, 'adminID' => $admin]);
 }
 public static function isFollow($followee)
 {
     if (\Auth::guest()) {
         return -1;
     } else {
         $count = DB::table('followings')->where('follower', '=', \Auth::user()->name)->where('followee', '=', $followee)->count();
         return $count;
     }
 }
Exemple #18
0
 public function deleteAllCustomerItem()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     customer_item::where('customer_id', '=', \Auth::user()->id)->update(array('status' => 1));
     return redirect('/');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //guest shouldn't be able to reach this page
     // but just in case....
     if (\Auth::guest()) {
         //return redirect('dashboard') ;
     }
     $aConv = Conversation::findOrFail($id);
     $aThread = Thread::select("*")->where("conversation_id", '=', $id)->firstOrFail()->get();
     return view('dashboard.edit')->with(['aConv' => $aConv, 'aThread' => $aThread]);
 }
Exemple #20
0
 public function LayerUser()
 {
     $user = \Auth::user();
     $guest = \Auth::guest();
     $currentroleuser = $user ? $user->roles : '';
     $userid = $user ? $user->id : 0;
     $layers = Layer::join('role_layer', function ($join) {
         $join->on('Layers.id_layer', '=', 'role_layer.layer_id');
     })->where('na', '=', 'N')->where('role_layer.role_id', '=', $userid)->with('roles')->orderBy('orderlayer', 'DESC');
     /*if($guest){
     			$layers = Layer::leftjoin('role_layer',function($join) {
     	      		$join->on('Layers.id_layer', '=', 'role_layer.layer_id');
     	    	})->where('na','=','N')	
     	    	->with('roles')->orderBy('orderlayer','DESC');
     		}*/
     $sql = $layers->toSql();
     $run_layers = $layers->get();
     $array = array();
     $operationallayer = array();
     foreach ($run_layers as $klyr => $layer) {
         $optionfeature['id'] = $layer->layer;
         $optionfeature['opacity'] = $layer->option_opacity;
         $optionfeature['visible'] = $layer->option_visible;
         $optionfeature['outFields'] = ['*'];
         $optionfeature['mode'] = 1;
         $optiondynamic['id'] = $layer->layer;
         $optiondynamic['opacity'] = $layer->option_opacity;
         $optiondynamic['visible'] = $layer->option_visible;
         $optiondynamic['outFields'] = ['*'];
         $optiondynamic['imageParameters'] = '';
         $options = $layer->tipelayer == 'dynamic' ? $optiondynamic : $optionfeature;
         $operationallayer_['type'] = $layer->tipelayer;
         $operationallayer_['url'] = $layer->layerurl;
         $operationallayer_['title'] = $layer->layername;
         $operationallayer_['options'] = $options;
         $layerIds = ['layerIds' => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]];
         $operationallayer_['identifyLayerInfos'] = $layerIds;
         $operationallayer_['roles'] = $layer->roles;
         array_push($operationallayer, $operationallayer_);
     }
     return json_encode($operationallayer);
     //return ($sql);
 }
 /**
  * Update a record in the "Users" table in database.
  *
  * @param  string  $provider
  * @param  string  $providerId
  * @return Message whether update was successful 
  */
 private function findAndUpdateUser($provider, $providerId)
 {
     /* Checking if user is not authorized. */
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     $provider_id_field = $provider . '_id';
     /* If user has already binded his social account with account in app. */
     if ($authUser = User::where($provider_id_field, $providerId)->first()) {
         return "No need for updating!";
     } else {
         /* Bind new {provider}_id values to the user */
         if ($authUser = User::where('email', \Auth::user()->email)->first()) {
             $authUser->{$provider_id_field} = $providerId;
             $authUser->save();
             return "Successfully updated!";
         }
         return 'No such user!';
     }
 }
 public function log()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     $activities = ActivityLog::orderBy('id', 'desc')->get();
     return view('admin/log')->with('activities', $activities);
 }
 public function addPhoto($id, Request $request)
 {
     if (\Auth::guest()) {
         return redirect('/');
     }
     $file = $request->file('file');
     $name = time() . $file->getClientOriginalName();
     $file->move('blog/photos', $name);
     $blog = Blog::findOrFail($id);
     $blog->photos()->create(['path' => 'blog/photos/' . $name . '']);
 }
Exemple #24
0
 public function activateUser($token)
 {
     $user = User::where('active_token', $token)->firstOrFail();
     if (!\Auth::guest() && $user->id == \Auth::id()) {
         return view('main.activate', compact('user'));
     } else {
         flash()->warning('Twoje konto jest aktywowane!');
         return redirect('/');
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     $client = Client::find($id);
     if (!$client) {
         return view('clients/show')->withErrors(['cardID' => 'Пользователя с данным номером карты не существует!']);
     } else {
         return view('clients/show')->with('client', $client);
     }
 }
 public function showTopic($id)
 {
     $topic = Topic::findOrFail($id);
     $replys = Reply::where('topic_id', $id)->paginate(20);
     if (!\Auth::guest() && \Auth::user()->isAdmin() || !\Auth::guest() && \Auth::user()->isMod()) {
         if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
             return view('forum.showTopic', compact('topic', 'replys'));
         } else {
             \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
             return view('forum.showTopic', compact('topic', 'replys'));
         }
     } else {
         if ($topic->forumSection->forumHead['forOrg'] == 0 && $topic->forumSection->forumHead['forBiz'] == 0) {
             if (\Auth::guest()) {
                 return view('forum.showTopic', compact('topic', 'replys'));
             }
             if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                 return view('forum.showTopic', compact('topic', 'replys'));
             } else {
                 \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                 return view('forum.showTopic', compact('topic', 'replys'));
             }
         } else {
             if (!\Auth::guest() && $topic->forumSection->forumHead['forOrg'] == \Auth::user()->queryLeaderHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } elseif (!\Auth::guest() && $topic->forumSection->forumHead['forOrg'] == \Auth::user()->queryMemberHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } elseif (!\Auth::guest() && $topic->forumSection->forumHead['forBiz'] == \Auth::user()->queryBmemberHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } elseif (!\Auth::guest() && $topic->forumSection->forumHead['forBiz'] == \Auth::user()->queryBleaderHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } else {
                 flash()->error('Nie masz dostępu do tego tematu!');
                 return redirect('/forum');
             }
         }
     }
 }
Exemple #27
0
 public function lootgame($lootId)
 {
     if (isset($lootId) && \DB::table('lootgames')->where('id', $lootId)->count()) {
         $loots = Loot::where('id', '=', $lootId)->get();
         foreach ($loots as $loot) {
             if ($loot->winner_id == 0) {
                 $winner = 0;
             } else {
                 $user = User::find($loot->user_id);
                 $winner = $user->username;
                 $winnerava = $user->avatar;
                 $winnersteam64 = $user->steamid64;
             }
         }
         $lots = [];
         foreach (Lots::where('game_id', '=', $lootId)->get() as $l) {
             $user = User::find($l->user_id);
             $lots[$l->to] = ['name' => $user->username, 'id' => $user->steamid64, 'avatar' => $user->avatar];
         }
         if (!\Auth::guest()) {
             $mez = Lots::where('game_id', '=', $lootId)->where('user_id', '=', $this->user->id)->count();
         } else {
             $mez = 0;
         }
         return view('pages.lootgame', compact('loots', 'lots', 'mez', 'winner'));
     }
     return redirect()->route('index');
 }