本文整理汇总了PHP中Input::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::has方法的具体用法?PHP Input::has怎么用?PHP Input::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postGroup
public function postGroup($id = null)
{
if (Input::has('id')) {
$group = Group::find(Input::get('id'));
if (!$group->isGroupOwner(Auth::user()->id)) {
return Response::json($this->growlMessage('You cannot modify a group you do not own.', 'error'));
}
$message = "Your group has been updated!";
} else {
$group = new Group();
$group->status = Group::STATUS_PENDING;
$message = "Your group has been created! It must be approved before you can invite others to join or create documents.";
}
$postData = array('name', 'display_name', 'address1', 'address2', 'city', 'state', 'postal_code', 'phone_number');
foreach ($postData as $field) {
$group->{$field} = Input::get($field);
}
if ($group->validate()) {
$group->save();
$group->addMember(Auth::user()->id, Group::ROLE_OWNER);
if ($group->status === Group::STATUS_PENDING) {
Event::fire(MadisonEvent::VERIFY_REQUEST_GROUP, $group);
}
return Response::json($this->growlMessage($message, 'success'));
} else {
return Response::json($this->growlMessage($group->getErrors()->all(), 'error'), 400);
}
}
示例2: show
/**
* Display the specified resource.
*
* @param string $location
* @return Response
*/
public function show()
{
$location = Input::get('location');
$type = strtolower(Input::get('type'));
$wildcardLocation = "%" . $location . "%";
if (Input::has('type')) {
$types = array('meeting-room', 'coworking', 'desk');
if (!in_array($type, $types, true)) {
return Redirect::to('/')->with('flash_message_404', "Sorry, we don't have that type of space so we brought you back home!");
}
$listings = Listing::with('thumbnail')->where('isPublic', '=', 1, "and")->where('space_type', '=', $type)->where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->orWhere('postcode', 'LIKE', $wildcardLocation)->get();
} else {
$listings = Listing::with('thumbnail')->where('isPublic', '=', 1, "and")->where('space_type', '=', $type)->where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->orWhere('postcode', 'LIKE', $wildcardLocation)->get();
}
$colNum = Listing::where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->where('isPublic', '=', '1')->count();
switch ($colNum) {
case 1:
$colNum = 12;
break;
case 2:
$colNum = 6;
break;
case 3:
$colNum = 3;
break;
}
$title = ucwords("Search: " . $type . " spaces in " . $location);
return View::make('search.results')->with('listings', $listings)->with('title', $title)->with('colNum', $colNum);
}
示例3: create
/**
* Create a Job
* @return \Illuminate\Http\JsonResponse
*/
public function create()
{
Log::info(\Input::all());
$inputdata = \Input::all();
$success = false;
$inputdata["mandate_start"] = strtotime($inputdata["mandate_start"]);
$inputdata["mandate_end"] = strtotime($inputdata["mandate_end"]);
$inputdata["date_of_entry"] = strtotime($inputdata["date_of_entry"]);
if ($this->validator->validate(\Input::all())) {
$job = Job::create($inputdata);
if (\Input::has('skills')) {
$skills = [];
foreach (\Input::get('skills') as $skill) {
$skills[$skill['skill_id']] = ['description' => isset($skill['description']) ? $skill['description'] : '', 'level' => isset($skill['level']) ? $skill['level'] : 0];
}
$job->skills()->attach($skills);
}
if (\Input::get('agent_id')) {
$agent = Agent::find(\Input::get('agent_id'));
// $job->agents()->attach($agent->user_id);
$job->agent_id = $agent->user_id;
}
}
$success = $job == true;
return \Response::json(['success' => $success]);
}
示例4: againcrazy
function againcrazy()
{
$DEFusername = 'guest';
$DEFpassword = 'password';
$username = '';
$password = '';
Auth::attempt($username, $password);
if (Input::has('username') && Input::has('password')) {
var_dump($test);
$username = Input::get('username');
$password = Input::get('password');
if (Auth::attempt($username, $password)) {
header('Location: http://codeup.dev/authorized.php');
exit;
} else {
if (Input::get('username') == '' && Input::get('password') == '') {
echo "please enter a username and password";
} else {
echo "that is not the correct username or password";
}
}
}
// if (isset($_SESSION['logged_in_user']) && $_SESSION['logged_in_user']) {
// header('Location: http://codeup.dev/authorized.php');
// exit;
// }
$passme = ['password' => $password, 'username' => $username];
return $passme;
}
示例5: scopeSort
/**
* Sort
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param string|null $sort Optional sort string
*
* @return \Illuminate\Database\Query\Builder
*/
public function scopeSort(Builder $builder, $sort = null)
{
if ((is_null($sort) || empty($sort)) && Input::has($this->getSortParameterName())) {
$sort = Input::get($this->getSortParameterName());
}
if (!is_null($sort)) {
$sort = explode(',', $sort);
foreach ($sort as $field) {
$field = trim($field);
$order = 'asc';
switch ($field[0]) {
case '-':
$field = substr($field, 1);
$order = 'desc';
break;
case '+':
$field = substr($field, 1);
break;
}
$field = trim($field);
if (in_array($field, $this->getSortable())) {
$builder->orderBy($field, $order);
}
}
}
}
示例6: postListar
/**
* Listar registro de celulas con estado 1
* POST /submodulo/listar
*
* @return Response
*/
public function postListar()
{
//si la peticion es ajax
if (Request::ajax()) {
//SI ENVIO EL CODIGO DEL USUARIO
//deberia buscar el menu y las submodulos asignadas a este usuario
if (Input::has('usuario_id')) {
$usuarioId = Input::get('usuario_id');
$submodulos = DB::table('submodulos')->select('id', 'nombre', DB::raw('CONCAT("M",modulo_id) as relation'))->where('estado', '=', '1')->orderBy('nombre')->get();
} elseif (Input::has('modulo_id')) {
//Auth::user()->id
//$perfilId = Session::get('perfilId');
$usuario = Usuario::find(Auth::user()->id);
$perfilId = $usuario['perfil_id'];
$moduloId = Input::get('modulo_id');
$submodulos = DB::table('submodulos as s')->leftjoin('submodulo_usuario as su', 's.id', '=', 'su.submodulo_id')->select('s.id', 's.nombre', 's.path')->where('modulo_id', '=', $moduloId)->where('s.estado', '=', 1);
//->where('su.estado', '=', 1);
if ($perfilId != 8) {
$submodulos = $submodulos->where('su.usuario_id', '=', Auth::user()->id);
}
//->where('su.usuario_id', '=', Auth::user()->id)
$submodulos = $submodulos->groupby('s.id')->orderBy('s.nombre')->get();
} else {
$submodulos = DB::table('submodulos')->select('id', 'nombre', DB::raw('CONCAT("M",modulo_id) as relation'))->where('estado', '=', '1')->orderBy('nombre')->get();
}
return Response::json(array('rst' => 1, 'datos' => $submodulos));
}
}
示例7: validate
function validate()
{
if (!Session::has('vatsimauth')) {
throw new AuthException('Session does not exist');
}
$SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
$session = Session::get('vatsimauth');
if (Input::get('oauth_token') !== $session['key']) {
throw new AuthException('Returned token does not match');
return;
}
if (!Input::has('oauth_verifier')) {
throw new AuthException('No verification code provided');
}
$user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
if ($user) {
Session::forget('vatsimauth');
$authUser = User::find($user->user->id);
if (is_null($authUser)) {
$authUser = new User();
$authUser->vatsim_id = $user->user->id;
$authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
}
$authUser->last_login = Carbon::now();
$authUser->save();
Auth::login($authUser);
Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
return Redirect::intended('/');
} else {
$error = $SSO->error();
throw new AuthException($error['message']);
}
}
示例8: getknowledge
public function getknowledge()
{
$this->layout->title = 'Corpers Knowledge Bank';
$this->layout->description = 'Visit the Corperlife knowledge bank to get all NYSC related questions answered.';
$this->layout->keywords = 'NYSC, questions, knowledge bank';
$this->layout->top_active = 5;
$this->layout->top_active_profile = 4;
$categories = DB::table('qus_category')->get();
$questions = DB::table('member_qus')->orderBy('member_qus.category_id', 'asc')->get();
$terms = DB::table('terms_definitions')->get();
if (Input::has('tab')) {
$tab = Input::get('tab');
} else {
$tab = 1;
}
if (Input::has('query') && Input::has('query') != '') {
$query = Input::get('query');
$query_results = DB::table('member_qus')->where('question', 'LIKE', "%" . $query . "%")->orWhere('answer', 'LIKE', "%" . $query . "%")->get();
$term_results = DB::table('terms_definitions')->where('term', 'LIKE', "%" . $query . "%")->orWhere('definition', 'LIKE', "%" . $query . "%")->get();
} else {
$query = '';
$query_results = [];
$term_results = [];
}
$this->layout->main = View::make("profile.pi.knowledge", ["tab" => $tab, "categories" => $categories, "questions" => $questions, 'terms' => $terms, 'query' => $query, 'query_results' => $query_results, 'term_results' => $term_results]);
}
示例9: create_album
public function create_album()
{
$fb = LazySalesHelper::fb();
$fbApp = LazySalesHelper::fbApp();
$accessToken;
if (Input::has('access_token')) {
$accessToken = Input::get('access_token');
} else {
$accessToken = $_SESSION['accessToken'];
}
try {
$request = new Facebook\FacebookRequest($fbApp, $accessToken, 'POST', '/' . Input::get('node') . '/albums', array('name' => Input::get('album_tittle'), 'message' => Input::get('album_decription')));
$response = $fb->getClient()->sendRequest($request);
$album_id = $response->getGraphNode()->getProperty('id');
$list_decrip = Input::get('list_decrip');
foreach (Input::get('list_images') as $key => $value) {
$request = new Facebook\FacebookRequest($fbApp, $accessToken, 'POST', '/' . $album_id . '/photos', array('source' => $fb->fileToUpload('../public/temp/' . $value), 'message' => $list_decrip[$key]));
$response = $fb->getClient()->sendRequest($request);
}
} catch (Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch (Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
}
示例10: store
public function store()
{
$userManager = new UserManagement();
$this->accountAddValidator->addRule("company", "required");
if (!$this->accountAddValidator->validate(Input::all())) {
Session::flash('error_msg', Utils::buildMessages($this->accountAddValidator->getValidation()->messages()->all()));
return Redirect::to('/customers/create')->withInput(Input::except("avatar"));
} else {
try {
$user = $userManager->createUser(["name" => Input::get("name"), "email" => Input::get("email"), "password" => Input::get("password"), "password_confirmation" => Input::get("password_confirmation"), "birthday" => Input::get("birthday"), "bio" => Input::get("bio"), "mobile_no" => Input::get("mobile_no"), "country" => Input::get("country"), "gender" => Input::get("gender"), "avatar" => Input::hasFile('avatar') ? Utils::imageUpload(Input::file('avatar'), 'profile') : ''], 'customer', Input::has("activated"));
$company_users = new CompanyCustomers();
$company_users->customer_id = $user->id;
$company_users->company_id = Input::get("company");
$company_users->save();
$this->mailer->welcome($user->email, $user->name, User::getWelcomeFields(false, $user->id, Input::get("password"), Input::get('company')));
RecentActivities::createActivity("Customer <a href='/customers/all'>ID:" . $user->id . "</a> created by User ID:" . Auth::user()->id . " User Name:" . Auth::user()->name);
if (!Input::has("activated")) {
$this->mailer->activate($user->email, $user->name, User::getActivateFields(false, $user->id, Input::get('company')));
}
Session::flash('success_msg', trans('msgs.customer_created_success'));
return Redirect::to('/customers/all');
} catch (\Exception $e) {
Session::flash('error_msg', trans('msgs.unable_to_add_customer'));
return Redirect::to('/customers/create')->withInput(Input::except("avatar"));
}
}
}
示例11: store
/**
* Stores new account
*
*/
public function store()
{
$user = new User();
$user->firstname = Input::get('firstname');
$user->lastname = Input::get('lastname');
$user->email = Input::get('email');
$matches = explode("@", $user->email);
$username = isset($matches[0]) ? $matches[0] : $user->firstname . '_' . $user->lastname;
$username = preg_replace("/[^0-9a-zA-Z-]/", '', $username);
$user->username = $username;
$user->password = Input::get('password');
$user->gender = Input::get('gender');
$user->type = Input::has('type') ? Input::get('type') : 'dreamer';
// The password confirmation will be removed from model
// before saving. This field will be used in Ardent's
// auto validation.
$user->password_confirmation = Input::get('password_confirmation');
// Save if valid. Password field will be hashed before save
$user->save();
if ($user->id) {
// Redirect with success message, You may replace "Lang::get(..." for your custom message.
return Redirect::action('UserController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
} else {
// Get validation errors (see Ardent package)
$error = $user->errors()->all(':message');
return Redirect::action('UserController@create')->withInput(Input::except('password'))->with('error', $error);
}
}
示例12: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
try {
// Find the user using the user id
$user = Sentry::findUserById($id);
if (Input::has('old_password')) {
if ($user->checkPassword(Input::get('old_password'))) {
$user->password = Input::get('new_password');
} else {
return Response::json(array('success' => false, 'message' => 'Password does not match.'));
}
} else {
$user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name');
}
if ($user->save()) {
return Response::json(array('success' => true, 'message' => 'Informasi User berhasil diupdate'));
} else {
return Response::json(array('success' => false, 'message' => 'Informasi User tidak berhasil diupdate'));
}
} catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
return Response::json(array('success' => false, 'message' => 'User tidak diketemukan'));
} catch (Cartalyst\Sentry\Users\UserExistsException $e) {
return Response::json(array('success' => false, 'message' => 'Email sudah Terdaftar'));
}
}
示例13: store
public function store(UserFormRequestDomain $request)
{
$validator = Validator::make($request->all(), $request->rules());
if ($validator->fails()) {
return redirect('create')->withErrors($validator)->withInput();
} else {
if (\Input::has('domain_id')) {
$id = \Input::get('domain_id');
$domain = DomainModel::find($id);
$alert['msg'] = 'Domain has been updated successfully';
} else {
$domain = new DomainModel();
$alert['msg'] = 'Domain has been created successfully';
}
$domain->user_id = \Session::get('user_id');
$domain->language_id = \Input::get('language_id');
$domain->template_id = \Input::get('template_id');
$domain->name = \Input::get('name');
$domain->description = \Input::get('description');
$domain->is_deleted = \Input::get('is_deleted');
$domain->save();
$alert['type'] = 'success';
return Redirect::route('domain')->with('alert', $alert);
}
}
示例14: add_comment
public function add_comment()
{
$record = RegisterRecord::find(Input::get('record_id'));
if (!isset($record)) {
return Response::json(array('error_code' => 2, 'message' => '无该记录'));
}
$user_id = RegisterAccount::find($record->account_id)->user_id;
if ($user_id != Session::get('user.id')) {
return Response::json(array('error_code' => 3, 'message' => '无效记录'));
}
if (!Input::has('content')) {
return Response::json(array('error_code' => 4, 'message' => '请输入评价'));
}
$old_comment = $record->comment()->get();
if (isset($old_comment)) {
return Response::json(array('error_code' => 5, 'message' => '已评论'));
}
$comment = new Comment();
$comment->record_id = $record->id;
$comment->content = Input::get('content');
if (!$comment->save()) {
return Response::json(array('error_code' => 1, 'message' => '添加失败'));
}
return Response::json(array('error_code' => 0, 'message' => '添加成功'));
}
示例15: anySearch
public function anySearch($search = false)
{
if (Input::has('q')) {
$search = Input::get("q", false);
}
$this->layout->content = View::make($this->theme("search"))->with("search", $this->getSearchResults($search));
}