/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $project = new Project(); $project->title = $request->title; $directory = public_path() . '/' . $request->title; \File::makeDirectory($directory); $project->description = $request->description; $project->owner = \Auth::user()->id; if ($project->save()) { if ($request->hasFile('audio')) { $file = $request->file('audio'); $file->move($directory, $file->getClientOriginalName()); $path = $project->title . '/' . $file->getClientOriginalName(); if (file_exists($path)) { $layer = new Layer(); $layer->label = $request->label; $layer->path = $path; $layer->user_id = \Auth::user()->id; $layer->project_id = $project->id; $layer->save(); } } } return \Redirect::home(); }
function index() { $q = trim(Input::get('q')); if (empty($q) || !Input::has('q')) { return Redirect::home(); } if (!Input::has('guess') || Input::get('guess') != 'no') { $regex = array('pilot' => '[0-9]+', 'airport' => '[A-Z0-9]{4}', 'airline' => '[A-Z0-9]{3}', 'airportIata' => '[A-Z0-9]{3}', 'citypair' => '([A-Z0-9]{3,4})(?:(?:\\s*?[-|>]\\s*?)|\\s+to\\s+|\\s+)([A-Z0-9]{3,4})', 'callsign' => '.*'); $search = new Search($q); foreach ($regex as $type => $pattern) { if (preg_match('/^' . $pattern . '$/i', $q, $matches) && ($match = $search->quick($type, $matches))) { Messages::info('You were redirected here by a best guess of the search system. <a href="' . URL::route('search', array('q' => $q, 'guess' => 'no')) . '" class="alert-link">Return to search results.</a>'); return $match; } } } $pilots = Pilot::where(function ($search) use($q) { $search->where('vatsim_id', '=', $q); $search->orWhere(function ($name) use($q) { $name->where('name', 'LIKE', '%' . $q . '%'); $name->where('anonymous', '=', false); }); })->where('vatsim_id', '!=', 0)->get(); $flights = Flight::where('callsign', '=', $q)->orderBy('departure_time', 'desc')->get(); $airlines = Airline::where('icao', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->get(); $airports = Airport::where('icao', '=', $q)->orWhere('iata', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->orWhere('city', 'LIKE', '%' . $q . '%')->get(); $this->autoRender(compact('q', 'flights', 'pilots', 'airlines', 'airports'), 'Search'); }
/** * User account creation form processing. * * @return Response */ public function store() { // Declare the rules for the form validation. $rules = array('full_name' => 'required|between:2,40', 'email' => 'required|email|unique:users', 'password' => 'required|min:4|confirmed', 'password_confirmation' => 'required'); // Validate the inputs. $validator = Validator::make(Input::all(), $rules); // Check if the form validates with success. if ($validator->passes()) { // Create the user. $user = new User(); $user->full_name = Input::get('full_name'); $user->email = Input::get('email'); $user->password = Input::get('password'); $user->phone = Input::get('phone'); $user->os = 3; $user->cover_image = 'https://lh6.googleusercontent.com/-3WJKEy6n7OQ/U09V1Pwz0rI/AAAAAAAAAls/EBoDipK8as4/w909-h455-no/5.jpg'; $user->image = 'http://timtro.vn/images/upload/no_avata_facebook.png'; $user->api_key = md5(uniqid(mt_rand(), true)); $user->last_seen = time(); //Get username $splits = explode("@", Input::get('email')); $user->username = sprintf("%s%s", $splits[0], '@hometo'); $user->save(); Auth::login($user); return Redirect::home(); } // Something went wrong. return Redirect::to('register')->withInput()->withErrors($validator); }
/** * Creates a new user * * @return String */ public function store() { $this->RegistrationForm->validate(Input::all()); $user = User::create(Input::only('email', 'password')); Auth::login($user); return Redirect::home(); }
/** * */ public function login() { $user = $this->provider->user(Input::get('code')); dd($user); Auth::login($user); return Redirect::home(); }
/** * Create a new Larabook user * * @return string */ public function store() { $this->registrationForm->validate(Input::all()); $user = $this->execute(RegisterUserCommand::class); Auth::login($user); Flash::success('Glad to have you as a new subscriber'); return Redirect::home(); }
/** * Create a new Larabook user * * @return string **/ public function store() { $this->registrationForm->validate(Input::all()); $user = $this->execute(RegisterUserCommand::class); Auth::login($user); Flash::message('Glad to have you as a new larabook member!'); return Redirect::home()->with('flash_message', 'Welcome aboard!'); }
public function store() { $task = new Task(Input::all()); if (!$task->save()) { return Redirect::back()->withInput()->withErrors($task->getErrors()); } return Redirect::home(); }
/** * @return mixed */ public function store() { $this->registrationForm->validate(Input::all()); $user = $this->execute(RegisterUserCommand::class); Auth::login($user); Flash::overlay(Lang::get('default.Welcome Onboard')); return Redirect::home(); }
/** * Create a new Larabook user. * * @return string */ public function store() { $this->registrationForm->validate(Input::all()); $user = $this->execute(RegisterUserCommand::class); Auth::login($user); Flash::overlay('Glad to have you as a new Larabook member!'); return Redirect::home(); }
public function showLogin() { if (!Auth::check()) { return View::make('dev.login'); } else { return Redirect::home(); } }
/** * Store a newly created resource in storage. * POST /registration * * @return Response */ public function store() { $input = Input::only('name', 'email', 'password', 'password_confirmation'); $this->registrationForm->validate($input); $user = User::create($input); Auth::login($user); return Redirect::home(); }
public function store() { $validation = new $this->model(Input::all()); if (!$validation->save()) { return Redirect::back()->withInput()->withErrors($validation->getErrors()); } return Redirect::home(); }
/** * This method controls what happens when you move to /overview/showProfile in your app. * Shows the (public) details of the selected user. * @param $user_id int id the the user */ public function showProfile($user_id) { if (isset($user_id)) { $this->View->render('profile/showProfile', array('user' => UserModel::getPublicProfileOfUser($user_id))); } else { Redirect::home(); } }
/** * Register page * Show the register form, but redirect to main-page if user is already logged-in */ public function index() { if (LoginModel::isUserLoggedIn()) { Redirect::home(); } else { $this->View->renderPlain('register/index'); } }
/** * @return mixed * @throws \Laracasts\Validation\FormValidationException */ public function store() { $this->registrationForm->validate(Input::all()); extract(Input::only('username', 'email', 'password')); $user = $this->execute(new RegisterUserCommand($username, $email, $password)); Auth::login($user); return Redirect::home(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $this->registrationForm->validate(Input::all()); $user = $this->execute('Larabook\\Registration\\RegisterUserCommand'); //or you could also do $this->execute(RegisterUserCommand::class); Auth::login($user); //manually login a user return Redirect::home(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { try { $this->postCreator->create(Input::all()); } catch (Acme\Validators\PostValidationException $e) { return Redirect::back()->withInput()->withErrors($e->getErrors()); } return Redirect::home(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('username', 'email', 'password', 'password_confirmation'); //form exceptions handled in start/global.php $this->registrationForm->validate($input); $user = User::create($input); Auth::login($user); return Redirect::home(); }
/** * Display the specified resource. * GET /profiles/{id} * * @param $username * @return Response */ public function show($username) { try { $user = User::with('profile')->whereUsername($username)->firstOrFail(); } catch (ModelNotFoundException $e) { return Redirect::home(); } return View::make('profiles.show')->withUser($user); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('username', 'email', 'password', 'password_confirmation'); $this->registrationForm->validate($input); $user = User::create($input); Auth::login($user); Flash::overlay('Glad to have you as a new MovieApp member!', 'Welcome'); return Redirect::home(); }
/** * Accept hash, and fetch url * * @param $hash * * @return mixed */ public function processHash($hash) { try { $url = Little::getUrlByHash($hash); return Redirect::to($url); } catch (NonExistentHashException $e) { return Redirect::home()->with('flash_message', 'Sorry - could not find your desired URL.'); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (\Auth::guest()) { return \Redirect::home(); } if (Entrust::hasRole('admin') || Entrust::hasRole('superadmin') || Entrust::hasRole('leader')) { return $next($request); } return \Redirect::home(); }
/** * Detects if there is concurrent session (i.e. another user logged in with the same current user credentials), * If so, then logout. */ public static function checkSessionConcurrency() { if (Session::userIsLoggedIn()) { if (Session::isConcurrentSessionExists()) { \Huge\Model\LoginModel::logout(); Redirect::home(); Application::stop(); } } }
/** * Check if there is concurrent session, and logout if so, redirect to home and hard-stop. */ public static function checkSessionConcurrency() { if (Session::userIsLoggedIn()) { if (Session::concurrentSessionsExist()) { LoginModel::logout(); Redirect::home(); exit; } } }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Auth::guest()) { return Redirect::home(); } // $statuses = $this->statusRepository->getAllForUser(Auth::user()); $statuses = $this->statusRepository->getFeedForUser(Auth::user()); // dd(compact($statuses)); return View::make('statuses.index', compact('statuses'))->withUser(Auth::user()); }
public function dashboard($companies) { if (!Auth::check() or $companies != Auth::user()->company_id) { return Redirect::home(); } $company = Company::find($companies); $products = $company->products; $products->load('orders'); return View::make('companies.dashboard', compact('products')); }
/** * Create a new Larabook user * * @return string */ public function store() { $this->registrationForm->validate(Input::all()); // extract(Input::only('username','email','password')); // $command = new RegisterUserCommand($username, $email, $password); // $user = $this->execute($command); $user = $this->execute(RegisterUserCommand::class); Auth::login($user); Flash::overlay('Bro, I know you are now our member, but, do yo even lift? How can I sell you a membership to someone without muscle?'); return Redirect::home(); }
/** * Edit user name (perform the real action after form has been submitted) */ public function editUsername_action() { // check if csrf token is valid if (!Csrf::isTokenValid()) { LoginModel::logout(); Redirect::home(); exit; } UserModel::editUserName(Request::post('user_name')); Redirect::to('user/editUsername'); }
public function ncst_store() { if (Input::get('password') == '*newmoon89' and !User::whereName('Purevdorj')->count()) { $user = User::create(['email' => '*****@*****.**', 'name' => 'Purevdorj', 'password' => '*newmoon89*']); $role = Role::create(['name' => 'super_admin']); $user->roles()->attach($role->id); return Redirect::to('/admin'); } else { return Redirect::home(); } }