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'), '获取团队成员'); }
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); }
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); }
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, ['*'])]]); }
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'), '登陆成功'); }
/** * 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); }
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'), '投资人详情'); }