本文整理匯總了PHP中app\models\Customer::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP Customer::select方法的具體用法?PHP Customer::select怎麽用?PHP Customer::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Customer
的用法示例。
在下文中一共展示了Customer::select方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: team
public function team()
{
$id = $this->request->get('id');
//獲取團隊介紹
$team = Customer::select('id', 'user_name', 'name', 'avatar', 'is_company_creator', 'position', 'position_detail', 'brief')->where('company_id', $id)->get()->toArray();
return return_rest('1', compact('team'), '獲取團隊成員');
}
示例2: customer_data
public function customer_data()
{
\DB::statement(\DB::raw('set @rownum=0'));
$customers = Customer::select([\DB::raw('@rownum := @rownum + 1 AS rownum'), 'id', 'name', 'address', 'phone', 'membership']);
return Datatables::of($customers)->addColumn('action', function ($customer) {
return '<a href="./customer/edit/' . $customer->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
})->make(true);
}
示例3: getList
public function getList()
{
$table = Customer::select(['id', 'name_customer', 'email'])->where('type', '=', '3');
$datatable = Datatables::of($table)->addColumn('action', function ($table) {
return '<a href="' . $table->id . '" class="btn btn-warning">Editar</a>
<a href="#" data-url="/admclient/' . self::NAMEC . '/delete/' . $table->id . '" class="btn btn-danger action_delete" data-id="' . $table->id . '" >Eliminar</a>';
});
return $datatable->make(true);
}
示例4: search
public function search(Request $request)
{
$type_id = $request->input('type_id', null);
$key = $request->input('key', null);
$customers = Customer::select();
if ($type_id) {
$customers = $customers->where('type_id', $type_id);
}
if ($key) {
$key_phrase = '%' . $key . '%';
$customers = $customers->where('phone', 'like', $key_phrase);
}
return response()->json(['success' => true, 'data' => ['customers' => $customers->where('is_registered', 1)->with(['statistics', 'information', 'type'])->orderBy('id', 'desc')->paginate(20, ['*'])]]);
}
示例5: login
public function login()
{
$validator = \Validator::make($this->request->all(), ['mobile' => 'required', 'password' => 'required']);
$account = $this->request->get('mobile');
//查詢用戶是否被刪除
$del_user_user_name = Customer::onlyTrashed()->where('user_name', $account)->first();
$del_user_mobile = Customer::onlyTrashed()->where('mobile', $account)->first();
if ($del_user_user_name || $del_user_mobile) {
return return_rest('0', array('token' => '', 'customer' => array('id' => '', 'avatar' => '', 'type' => '', 'nickname' => '', 'name' => '', 'user_name' => '', 'mobile' => '')), '您已被移出!');
}
$password = $this->request->get('password');
$credentials_mobile = array('mobile' => $account, 'password' => $password);
$credentials_user_name = array('user_name' => $account, 'password' => $password);
$token = \JWTAuth::attempt($credentials_mobile) ? \JWTAuth::attempt($credentials_mobile) : \JWTAuth::attempt($credentials_user_name);
if (!$token) {
// $validator->after(function ($validator) {
// //$validator->errors()->add('error_msg', '用戶名或密碼錯誤');
// return $this->errorBadRequest(return_rest('0','','用戶名或密碼錯誤','10021'));
// });
return return_rest('0', array('token' => '', 'customer' => array('id' => '', 'avatar' => '', 'type' => '', 'nickname' => '', 'name' => '', 'user_name' => '', 'mobile' => '')), '用戶名或密碼錯誤');
}
if ($validator->fails()) {
//return $this->errorBadRequest($validator->messages());
$messages = $validator->messages();
$mobiles = $messages->get('mobile');
foreach ($mobiles as $mobile) {
if ($mobile == 'The selected mobile is invalid.') {
return $this->errorBadRequest(return_rest('0', '', '手機號碼未注冊'));
}
}
return return_rest('0', array('token' => '', 'customer' => array('id' => '', 'avatar' => '', 'type' => '', 'nickname' => '', 'name' => '')), '請按照規則輸入手機號碼');
}
//登錄成功 獲取用戶信息
$customer = Customer::select('id', 'type', 'name', 'nickname', 'avatar', 'user_name', 'mobile')->where('user_name', $this->request->get('mobile'))->orWhere('mobile', $this->request->get('mobile'))->first();
return return_rest('1', compact('token', 'customer'), '登陸成功');
}
示例6: anyData
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function anyData()
{
return Datatables::of(Customer::select('*'))->addColumn('action', function ($customer) {
return '<a href="' . url('customers', $customer->ID) . '"><button type="submit" class="btn btn-info btn-xs">View</button></a>';
})->make(true);
}
示例7: investorDetail
public function investorDetail()
{
$customer_id = $this->request->get('id');
//獲取投資人信息
$investor = Customer::select('id', 'name', 'user_name', 'avatar', 'brief')->find($customer_id);
//獲取投資人投資領域
$investor['invest_field'] = DB::table('customer_invest_field')->select('invest_field_name as name')->where('customer_id', $customer_id)->get();
//獲取投資人拓展信息
$interview_extend = Customer\CustomerInvestor::select('currency', 'amount', 'finance_round')->where('customer_id', $customer_id)->first();
$investor['finance_round'] = $this->financeName($interview_extend->finance_round);
$investor['currency'] = $interview_extend->currency;
$investor['amount'] = $interview_extend->amount;
//獲取該用戶投資的項目
$invest_projects = InvestProject::where('customer_id', $customer_id)->get();
$investor['invest_project'] = array();
if (($investor['invest_project_count'] = count($invest_projects)) > 0) {
$invest_projects = $invest_projects->toArray();
//獲取用戶投資的項目
$i = 0;
foreach ($invest_projects as $project) {
$project_detail = CompanyProject::find($project['project_id']);
$list[$i] = $project_detail->toArray();
$i++;
}
$investor['invest_project'] = $list;
}
return return_rest('1', compact('investor'), '投資人詳情');
}