当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::where方法代码示例

本文整理汇总了PHP中app\Client::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::where方法的具体用法?PHP Client::where怎么用?PHP Client::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Client的用法示例。


在下文中一共展示了Client::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 public function store()
 {
     // validate
     // read more on validation at http://laravel.com/docs/validation
     $rules = array('full_name' => 'required', 'name' => 'required', 'inn' => 'required', 'kpp' => 'required|size:9', 'ogrn' => 'required|unique:clients|size:13');
     $validator = Validator::make(Input::all(), $rules);
     // process the login
     if ($validator->fails()) {
         return redirect()->back()->with('danger', 'Данные клиента введены неверно')->withInput();
     } else {
         if (count(Client::where('inn', '=', Input::get('inn'))->get()) > 0) {
             return redirect()->back()->with('danger', 'Клиент с данным ИНН уже имеется в базе')->withInput();
         } else {
             var_dump($this->is_valid_inn((int) Input::get('inn')));
             if ($this->is_valid_inn((int) Input::get('inn'))) {
                 //Проверка инн
                 $client = new Client();
                 $client->full_name = Input::get('full_name');
                 $client->name = Input::get('name');
                 $client->inn = Input::get('inn');
                 $client->kpp = Input::get('kpp');
                 $client->ogrn = Input::get('ogrn');
                 $client->save();
                 // redirect
                 //*Request::flashOnly('message', 'Клиент добавлен');*/
                 Session::flash('success', 'Клиент добавлен');
                 return Redirect::to('client/' . $client->id . '/agreement');
             } else {
                 return redirect()->back()->with('danger', 'ИНН введен не верно')->withInput();
             }
         }
     }
 }
开发者ID:PixelPartyRu,项目名称:erp,代码行数:33,代码来源:ClientController.php

示例2: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Validator::extend('check_auth_user_password', function ($attribute, $value, $parameters, $validator) {
         return Hash::check($value, Auth::user()->password);
     });
     // Make sure client email is not used by another client of current user
     Validator::extend('email_not_used_by_another_user_client', function ($attribute, $value, $parameters, $validator) {
         if (Client::where('user_id', Auth::user()->id)->where('email', $value)->count()) {
             return false;
         }
         return true;
     });
     // Make sure client phone number is not user by another client of current user
     Validator::extend('phone_number_not_used_by_another_user_client', function ($attribute, $value, $parameters, $validator) {
         if (Client::where('user_id', Auth::user()->id)->where('phone_number', $value)->count()) {
             return false;
         }
         return true;
     });
     Validator::extend('not_exists', function ($attribute, $value, $parameters, $validator) {
         return !DB::table($parameters[0])->where($parameters[1], $value)->count();
     });
     Validator::extend('is_not_in_auth_user_products', function ($attribute, $value, $parameters, $validator) {
         return !DB::table('products')->where('user_id', \Auth::user()->id)->where('code', $value)->count();
     });
 }
开发者ID:bitller,项目名称:nova,代码行数:31,代码来源:AppServiceProvider.php

示例3: clientsForUser

 public function clientsForUser($user = null)
 {
     if ($user != null) {
         return \App\Client::where('user_id', $user->id)->get();
     }
     return \App\Client::where('user_id', $this->user()->id)->get();
 }
开发者ID:Jemok,项目名称:skoolspace,代码行数:7,代码来源:Controller.php

示例4: handleAction

 public function handleAction(Request $request)
 {
     $action = $request->input('_action');
     if ($action == 'createClient') {
         //Creation :
         Client::create($request->all());
         // FLash messaging :
         flash()->success('Opération réussie!', 'Client créé avec succès.');
     } else {
         if ($_POST['_action'] == 'getClientByID') {
             $id = $_POST['_uid'];
             $client = Client::where('id', $id)->with('files')->first();
             return response(['status' => 'success', 'client' => $client], 200);
         } else {
             if ($_POST['_action'] == 'editClient') {
                 $id = $_POST['id'];
                 $client = Client::find($id);
                 $client->lastname = $_POST['lastname'];
                 $client->firstname = $_POST['firstname'];
                 $client->email = $_POST['email'];
                 $client->street = $_POST['street'];
                 $client->postal_code = $_POST['postal_code'];
                 $client->city = $_POST['city'];
                 $client->vat = $_POST['tva'];
                 $client->mobile = $_POST['mobile'];
                 $client->office = $_POST['office'];
                 $client->fax = $_POST['fax'];
                 $client->save();
                 flash()->success('Opération réussie!', 'Client modifé avec succès.');
             } else {
             }
         }
     }
     return redirect('/clients');
 }
开发者ID:ninir007,项目名称:Ats,代码行数:35,代码来源:ClientsController.php

示例5: create

 function create()
 {
     $id = Input::get('id');
     if (Input::get('muayneDurumu') != 'ertelendi') {
         $hour = Input::get('saat');
         $app_date = Input::get('tarih');
     } else {
         $hour = Input::get('ysaat');
         $app_date = Input::get('yTarih');
     }
     $client = array('name' => Input::get('ad'), 'last_name' => Input::get('soyad'), 'email' => Input::get('email'), 'tel' => Input::get('tel'), 'app_date' => $app_date, 'hour_id' => $hour, 'doctor_id' => Input::get('doktor'), 'confirmation' => 1, 'message' => Input::get('mesaj'));
     $update = Client::where('id', Input::get('id'))->update($client);
     if ($update || Input::get('muayneDurumu') != null) {
         $client_detail = array('client_id' => Input::get('id'), 'app_date' => $app_date, 'hour_id' => $hour, 'made_operation' => Input::get('yapilanIslem'), 'doctor_id' => Input::get('doktor'), 'after_operation' => Input::get('yapilacakIslem'), 'status' => Input::get('muayneDurumu'));
         $create = ClientDetail::create($client_detail);
         if ($create) {
             $client = Client::find($id);
             $_SESSION['mesaj'] = '<div class="form-signin" style="background-color:pink;"><center><p style="color:green;">İşlem başarıyla gerçekleştirildi.</p></center></div>';
             return view('clients.appointment', ['client' => $client]);
         }
     } else {
         $client = Client::find($id);
         $_SESSION['mesaj'] = '<div class="form-signin" style="background-color:pink;"><center><p style="color:red;">İşelem gerçekleştirilmedi</p></center></div>';
         return view('clients.appointment', ['client' => $client]);
     }
 }
开发者ID:ufukpalavar52,项目名称:laravel-php-projelerim,代码行数:26,代码来源:ClientDetailsController.php

示例6: submitOTP

 public function submitOTP(Request $request)
 {
     //get mobile number from user input
     $mobileNum = $request->input('mobile');
     //get user type from user input
     $userType = $request->input('userType');
     //set user email
     $userEmail = 'new_user@email.com';
     //set country code
     $countryCode = 61;
     //initial authentication API
     // $authy_api = new AuthyApi(config('services.authy.key'));
     $authy_api = new AuthyApi(config('services.authy.key'), 'http://sandbox-api.authy.com');
     //sandbox
     //register a user through email, cellphone, country_code
     $user = $authy_api->registerUser($userEmail, $mobileNum, $countryCode);
     //generate authentication token and send it to usser
     $sms = $authy_api->requestSms($user->id(), array("force" => "true"));
     if ($sms->ok()) {
         //check user exist or not
         $results = Client::where('mobile', $mobileNum)->first();
         //if user does not exist, register of him
         if (empty($results)) {
             $newUser = new Client();
             $newUser->mobile = $mobileNum;
             $newUser->save();
         }
         return view('auth.otp')->with('userid', $user->id())->with('mobileNum', $mobileNum)->with('userType', $userType);
     } else {
         //session()->put('message','incorrect mobile number');
         return redirect('login')->with('message', 'Please input correct mobile number');
     }
 }
开发者ID:J-Guo,项目名称:paydate,代码行数:33,代码来源:AuthController.php

示例7: index

 public function index()
 {
     \App\Gini\Gapper\Client::init();
     if (\App\Gini\Gapper\Client::getUserName()) {
         return view('dashboard', ['products_count' => Product::count(), 'servers_count' => Server::count(), 'clients_count' => Client::where('parent_id', 0)->count(), 'projects_count' => Project::count()]);
     }
     return view('login');
 }
开发者ID:genee-projects,项目名称:snail,代码行数:8,代码来源:DashboardController.php

示例8: checkIfExists

 /**
  * reads Project table by unique index
  *  - if not found, emit a not found message.
  *  - if found return the $project record to the caller.
  *
  * @param [in] $text
  * @return a record.
  */
 public static function checkIfExists($text)
 {
     $client = Client::where('name', '=', $text)->first();
     if (!is_null($client)) {
         appGlobals::existsMessage(appGlobals::getClientTableName(), $client->name, $client->id);
     }
     return $client;
 }
开发者ID:RichJones22,项目名称:TimeTrax,代码行数:16,代码来源:Client.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = \Auth::user()->id;
     // get the id of the logged in user
     $clients = Client::where('user_id', $user)->get();
     // only get clients belonging to logged user
     return view('clients.index', compact('clients'));
 }
开发者ID:gman07140,项目名称:laravet,代码行数:13,代码来源:ClientsController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $clients = Client::where('status', 'active')->get();
     foreach ($clients as $client) {
         $client->client_id = $client->id + 1000;
     }
     return $clients;
     return view('app.clients', ['clients' => $clients]);
 }
开发者ID:naughton-and-ross,项目名称:clientapp,代码行数:14,代码来源:ClientController.php

示例11: jsonGetNameByPhone

 public function jsonGetNameByPhone($number)
 {
     $client = Client::where('phone', $number)->first();
     if (is_null($client)) {
         return "";
     } else {
         return $client->name;
     }
 }
开发者ID:yaroslavmelnichuk,项目名称:LarkaKursova,代码行数:9,代码来源:ClientController.php

示例12: run

 public function run()
 {
     $client = Client::where('name', '=', 'Exhibit Partners')->first();
     Contact::create(['first_name' => 'Seth Cindra', 'email' => 'info@cindra.net', 'client_id' => $client->id]);
     Contact::create(['first_name' => 'Seth TRMS', 'email' => 'seth.phillips@trms.com', 'client_id' => $client->id]);
     Contact::create(['first_name' => 'Seth BlackKat', 'email' => 'black_kat_recording@yahoo.com', 'client_id' => $client->id]);
     Contact::create(['first_name' => 'Dane Giles', 'email' => 'dane@exhibitpartners.com', 'client_id' => $client->id]);
     Contact::create(['first_name' => 'Bill Gench', 'email' => 'bill@exhibitpartners.com', 'client_id' => $client->id]);
     Contact::create(['name' => 'Debs Holloway', 'email' => 'DebS@exhibitpartners.com', 'client_id' => $client->id]);
 }
开发者ID:sethphillips,项目名称:event_mailer,代码行数:10,代码来源:DatabaseSeeder.php

示例13: filter

 public function filter()
 {
     $input = Request::all();
     $filter = $input['filter'];
     $clients = Client::where('status', $filter)->paginate(10);
     if ($filter == "All") {
         return redirect()->action('ClientsController@index');
     }
     $clients->appends(Request::only('filter'));
     return view('clients.index', compact('clients'));
 }
开发者ID:jacqhernandez,项目名称:hsms,代码行数:11,代码来源:ClientsController.php

示例14: getClients

 /**
  * Get clients of given user.
  *
  * @param bool $userId
  * @return mixed
  */
 public static function getClients($userId = false)
 {
     // If an user id is not given use the id of current logged in user
     if (!$userId) {
         $userId = Auth::user()->id;
     }
     $clients = Client::where('user_id', $userId)->paginate();
     foreach ($clients as &$client) {
         $client->orders = Bill::where('client_id', $client->id)->count();
     }
     return response($clients)->header('Content-Type', 'application/json');
 }
开发者ID:bitller,项目名称:nova,代码行数:18,代码来源:User.php

示例15: search

 /**
  * Run a general search.
  * @return  array of objects with the search results.
  */
 public function search()
 {
     $q = Input::get("q");
     // redirect user back if nothing was typed
     if (empty(trim($q))) {
         return Redirect::back();
     }
     $clients = Client::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $projects = Project::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $tasks = Task::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $pTitle = "Search Results";
     return View::make('search', compact('q', 'clients', 'projects', 'tasks', 'pTitle'));
 }
开发者ID:siparker,项目名称:ribbbon,代码行数:17,代码来源:HomeController.php


注:本文中的app\Client::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。