本文整理汇总了PHP中app\models\Client::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::find方法的具体用法?PHP Client::find怎么用?PHP Client::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Client
的用法示例。
在下文中一共展示了Client::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDetail
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function getDetail($id)
{
$client = Client::find($id);
$data_clients = DataClient::with("client")->where("client_id", "=", $id)->get();
return view("clients.detail")->with(array('client' => $client, 'data_client' => $data_clients));
return redirect()->back();
}
示例2: actionIndex
public function actionIndex()
{
// remove session 'msetting'
Yii::$app->session->remove('msetting');
$clients = Client::find()->all();
return $this->render('index', ['clients' => $clients]);
}
示例3: getPedidos
public function getPedidos($id)
{
$client = Client::find($id);
$pedido = Pedido::with('client')->where('client_id', '=', $id)->get();
//dd($pedido->toArray());
return view("data_clients.pedidos")->with(array('client' => $client, 'pedido' => $pedido));
return redirect()->back();
}
示例4: actionUpdate
/**
* Updates an existing Event model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', ['model' => $model, 'zal' => Zal::find()->asArray()->all(), 'client' => Client::find()->asArray()->orderBy('name_client')->all(), 'users' => Users::find()->asArray()->where(['status' => 10])->orderBy('username')->all()]);
}
}
示例5: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Client::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'client_type_id' => $this->client_type_id, 'discipline_id' => $this->discipline_id, 'status' => $this->status]);
$query->andFilterWhere(['like', 'client_id', $this->client_id])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name]);
return $dataProvider;
}
示例6: actionLists
public function actionLists($id)
{
$countPosts = Client::find()->where(['iddirection' => $id])->count();
$posts = \app\models\Client::find()->where(['iddirection' => $id])->orderBy('nameclient')->all();
if ($countPosts > 0) {
foreach ($posts as $post) {
echo "<option value='" . $post->id . "'>" . $post->nameclient . " - " . $post->namevid . "</option>";
}
} else {
echo "<option>-</option>";
}
}
示例7: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Client::find()->select("CONCAT_WS(' ',`surname`,clients.`name`) as name,phone,address, sum(cost*count) as cost,clients.id as id")->leftJoin(Order::tableName(), Order::tableName() . '.id_client=' . Client::tableName() . '.id')->groupBy('id_client');
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['name' => $this->name, 'surname' => $this->surname, 'phone' => $this->phone, 'address' => $this->address]);
return $dataProvider;
}
示例8: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Client::find();
$dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['name_client' => SORT_ASC]]]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'name_client', $this->name_client])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'info', $this->info]);
return $dataProvider;
}
示例9: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Client::find()->active();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'cuit', $this->cuit])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'delivery_address', $this->delivery_address])->andFilterWhere(['like', 'payment_conditions', $this->payment_conditions])->andFilterWhere(['like', 'notes', $this->notes]);
return $dataProvider;
}
示例10: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Client::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['clientNumber' => $this->clientNumber, 'salesRepEmployeeNumber' => $this->salesRepEmployeeNumber, 'creditLimit' => $this->creditLimit]);
$query->andFilterWhere(['like', 'clientName', $this->clientName])->andFilterWhere(['like', 'contactLastName', $this->contactLastName])->andFilterWhere(['like', 'contactFirstName', $this->contactFirstName])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'addressLine1', $this->addressLine1])->andFilterWhere(['like', 'addressLine2', $this->addressLine2])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'postalCode', $this->postalCode])->andFilterWhere(['like', 'country', $this->country]);
return $dataProvider;
}
示例11: add_advertiser
public function add_advertiser(Request $request)
{
if (Auth::check()) {
if (in_array('ADD_EDIT_ADVERTISER', $this->permission)) {
$validate = \Validator::make($request->all(), Advertiser::$rule);
if ($validate->passes()) {
if (User::isSuperAdmin()) {
$client_obj = Client::find($request->input('client_id'));
} else {
$usr_company = $this->user_company();
$client_obj = Client::whereIn('user_id', $usr_company)->find($request->input('client_id'));
}
if ($client_obj) {
$active = 'Inactive';
if ($request->input('active') == 'on') {
$active = 'Active';
}
$audit = new AuditsController();
$audit_key = $audit->generateRandomString();
$advertiser = new Advertiser();
$advertiser->name = $request->input('name');
$advertiser->domain_name = $request->input('domain_name');
$advertiser->status = $active;
$advertiser->description = $request->input('description');
$advertiser->client_id = $request->input('client_id');
$advertiser->save();
if ($request->has('to_model')) {
foreach ($request->input('to_model') as $index) {
$adv_mdl_map = new Advertiser_Model_Map();
$adv_mdl_map->advertiser_id = $advertiser->id;
$adv_mdl_map->model_id = $index;
$adv_mdl_map->save();
$audit->store('adv_mdl_map', $index, $advertiser->id, 'add', $audit_key);
}
}
$audit->store('advertiser', $advertiser->id, null, 'add', $audit_key);
return Redirect::to(url('/client/cl' . $request->input('client_id') . '/advertiser/adv' . $advertiser->id . '/edit'))->withErrors(['success' => true, 'msg' => "Advertiser added successfully"]);
}
return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput();
}
return Redirect::back()->withErrors(['success' => false, 'msg' => $validate->messages()->all()])->withInput();
}
return Redirect::back()->withErrors(['success' => false, 'msg' => "You don't have permission"]);
}
return Redirect::to(url('user/login'));
}
示例12: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Client::find();
$query->joinWith(['clientType', 'discipline']);
$dataProvider = new ActiveDataProvider(['query' => $query]);
$dataProvider->sort->attributes['clientType'] = ['asc' => ['client_type.type' => SORT_ASC], 'desc' => ['client_type.type' => SORT_DESC]];
$dataProvider->sort->attributes['discipline'] = ['asc' => ['discipline.name' => SORT_ASC], 'desc' => ['discipline.name' => SORT_DESC]];
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'client.active' => $this->active]);
$query->andFilterWhere(['like', 'client_id', $this->client_id])->andFilterWhere(['like', 'full_name', $this->full_name])->andFilterWhere(['like', 'client_type.type', $this->clientType])->andFilterWhere(['like', 'discipline.name', $this->discipline]);
//->andFilterWhere(['like', 'active', ($this->active) ? 'Si' : 'No']);
return $dataProvider;
}
示例13: actionGroup
/**
* filter for group
* @return array json
*/
public function actionGroup()
{
$fil = Yii::$app->request->post()['name'];
Yii::$app->response->format = 'json';
if ($fil && $fil !== 'all') {
$group = Group::find()->where(['name' => trim($fil)])->one();
if ($group) {
if (!empty($group->groupsClients)) {
$clients = [];
foreach ($group->groupsClients as $key => $gc) {
array_push($clients, $gc->client);
}
return ['errors' => '', 'data' => $this->renderPartial('_clients', ['results' => $clients])];
}
}
return ['errors' => '', 'data' => ''];
} elseif ($fil && $fil === 'all') {
return ['errors' => '', 'data' => $this->renderPartial('_clients', ['results' => Client::find()->all()])];
}
}
示例14: postDelete
public function postDelete()
{
if (Input::has('id')) {
DB::transaction(function () {
$client = Client::find(Input::get('id'));
if (!empty($client->logo)) {
File::delete($client->logo);
}
Client::destroy(Input::get('id'));
echo "1";
});
$this->clearCache();
} else {
echo "0";
}
}
示例15: function
<p>
<?php
echo Html::a('Добавить командировку', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
$gridColumns = [['class' => 'yii\\grid\\ActionColumn'], ['attribute' => 'numbertrip', 'label' => '№ Командировки'], ['attribute' => 'iduserdata', 'filter' => ArrayHelper::map(\app\models\Userdata::find()->orderBy('pib')->asArray()->all(), 'id', 'pib'), 'label' => 'Фамилия Имя Отчество', 'value' => function ($data) {
return $data->userdata1->pib;
}], ['attribute' => 'depart', 'filter' => ArrayHelper::map(\app\models\Depart::find()->orderBy('name_depart')->asArray()->all(), 'id', 'name_depart'), 'value' => function ($data) {
return $data->userdata1->idDepart->name_depart;
}], ['attribute' => 'test', 'value' => function ($data) {
return $data->client1->directions->sity;
}], ['attribute' => 'idclient', 'label' => 'Предприятие для командировки ', 'headerOptions' => ['width' => '380'], 'filter' => ArrayHelper::map(\app\models\Client::find()->orderBy('nameclient')->asArray()->all(), 'id', 'nameclient'), 'width' => '150px', 'value' => function ($data) {
return $data->client1->nameclient;
}], ['attribute' => 'idproject', 'label' => 'Проект/Клиент для командировки', 'filter' => ArrayHelper::map(\app\models\Project::find()->orderBy('name_project')->asArray()->all(), 'id', 'name_project'), 'value' => function ($data) {
return $data->project1->name_project;
}], ['attribute' => 'date_otpr', 'label' => 'Дата отправления', 'format' => 'datetime'], ['attribute' => 'date_pr', 'label' => 'Дата прибытия.', 'format' => 'datetime'], ['attribute' => 'date_otpr1', 'label' => 'Дата отправления', 'format' => 'datetime'], ['attribute' => 'date_pr1', 'label' => 'Дата прибытия.', 'format' => 'datetime'], ['label' => 'Количество дней', 'value' => function ($data) {
$datetime1 = new DateTime(date('Y-m-d', $data->date_otpr));
$datetime2 = new DateTime(date('Y-m-d', $data->date_pr1));
$interval = $datetime1->diff($datetime2);
$interval = $interval->format('%R%a');
$interval = $interval + 1;
return $interval;
}], ['attribute' => 'daily', 'format' => ['decimal', 2]], ['label' => 'Командировочные', 'format' => ['decimal', 2], 'value' => function ($data) {
$datetime1 = new DateTime(date('Y-m-d', $data->date_otpr));
$datetime2 = new DateTime(date('Y-m-d', $data->date_pr1));
$interval = $datetime1->diff($datetime2);
$interval = $interval->format('%R%a');