當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::select方法代碼示例

本文整理匯總了PHP中app\Client::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::select方法的具體用法?PHP Client::select怎麽用?PHP Client::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Client的用法示例。


在下文中一共展示了Client::select方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: performGetClientIdsQuery

 /**
  * Do get client ids query and return them in an array.
  *
  * @param array $config Returned by inspectGetConfigAndAddDefaultValuesToMissingOptions method
  * @return array
  */
 protected static function performGetClientIdsQuery($config)
 {
     $clientIdsQuery = Client::select('id')->where('clients.user_id', $config['userId']);
     // Check if search term is given
     if (isset($config['searchTerm']) && strlen($config['searchTerm']) > 0) {
         $clientIdsQuery = $clientIdsQuery->where('clients.name', 'like', $config['searchTerm'] . '%')->get();
     } else {
         $clientIdsQuery = $clientIdsQuery->get();
     }
     // Build an array that contains only clint ids
     $clientIds = [];
     foreach ($clientIdsQuery as $result) {
         $clientIds[] = $result->id;
     }
     return $clientIds;
 }
開發者ID:bitller,項目名稱:nova,代碼行數:22,代碼來源:ProtectedHelpers.php

示例2: function

<?php

use App\User;
use App\Client;
use App\Time;
use App\Project;
use Faker\Generator as FakerGenerator;
$factory->define(User::class, function (FakerGenerator $faker) {
    return ['name' => $faker->name, 'email' => $faker->safeEmail, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)];
});
$factory->define(Client::class, function (FakerGenerator $faker) {
    return ['active' => $faker->boolean(50), 'name' => $faker->company(), 'contactName' => $faker->name(), 'contactEmail' => $faker->safeEmail(), 'address1' => $faker->streetAddress(), 'address2' => $faker->secondaryAddress(), 'city' => $faker->city(), 'locality' => $faker->stateAbbr(), 'postalCode' => $faker->postcode(), 'phone' => $faker->phoneNumber()];
});
$factory->define(Project::class, function (FakerGenerator $faker) {
    $randomClient = Client::select('id')->orderByRaw('RANDOM()')->limit(1)->first();
    return ['client_id' => $randomClient->id, 'name' => sprintf('%s %s %d', 'Project', $faker->colorName(), $faker->randomDigit()), 'active' => $faker->boolean(), 'billable' => $faker->boolean(), 'taxDeducted' => $faker->boolean()];
});
$factory->define(Time::class, function (FakerGenerator $faker) {
    $randomHours = $faker->numberBetween(1, 8);
    $randomMinutes = $faker->numberBetween(0, 180);
    $randomProject = Project::select('id')->orderByRaw('RANDOM()')->limit(1)->first();
    $randomUser = User::select('id')->orderByRaw('RANDOM()')->limit(1)->first();
    $start = $faker->dateTimeBetween('-10 years', '-1 day');
    return ['user_id' => $randomUser->id, 'start' => $start, 'minutes' => $randomMinutes, 'estimatedDuration' => $faker->numberBetween(1, 480), 'summary' => $faker->paragraph(), 'project_id' => $randomProject->id];
});
開發者ID:lovett,項目名稱:toils,代碼行數:25,代碼來源:ModelFactory.php

示例3: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $user = User::findOrFail($id);
     $clients = Client::select('id', \DB::raw('CONCAT(firm_name, " ", first_name, " ", last_name) as full_name'))->lists('full_name', 'id');
     return view('admin.user.edit', compact('user', 'clients'));
 }
開發者ID:thibaultvanc,項目名稱:organit,代碼行數:13,代碼來源:UserController.php

示例4: getClients

 /**
  * Paginate clients.
  *
  * @return mixed
  */
 public function getClients()
 {
     return Client::select(DB::raw('clients.*, COUNT(bills.id) as number_of_orders'))->leftJoin('bills', 'bills.client_id', '=', 'clients.id')->where('clients.user_id', Auth::user()->id)->orderBy('clients.created_at', 'desc')->groupBy('clients.id')->paginate(Settings::displayedClients());
 }
開發者ID:bitller,項目名稱:nova,代碼行數:9,代碼來源:ClientsController.php

示例5: get

 /**
  * Get from query
  */
 public function get($page = null)
 {
     return $this->query(Client::select(), $page);
 }
開發者ID:jiannius,項目名稱:lar5-invie,代碼行數:7,代碼來源:ClientRepo.php


注:本文中的app\Client::select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。