本文整理汇总了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;
}
示例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];
});
示例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'));
}
示例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());
}
示例5: get
/**
* Get from query
*/
public function get($page = null)
{
return $this->query(Client::select(), $page);
}