protected function findModel($id) { if (($model = Services::find()->where(['id' => $id])->one()) !== null) { return $model; } else { throw new NotFoundHttpException('Запрошенная страница не найдена.'); } }
/** * Display a listing of the resource. * * @return \Illuminate\View\View */ public function index() { if (\Auth::user() && \Auth::user()->profile->city_id != null) { $services = Services::where('time', '>=', new \DateTime('today'))->where('city_id', '=', \Auth::user()->profile->city_id)->get(); return view('services.index', compact('services')); } else { $services = Services::where('time', '>=', new \DateTime('today'))->get(); return view('services.index', compact('services')); } }
public function actionIndex() { /* $dataProvider = new ActiveDataProvider([ 'query' => Categories::find()->where(['id_parent'=>0]), /*'pagination' => [ 'pageSize' => 10, ], 'pagination' => false, ]);*/ $dataProvider = new ActiveDataProvider(['query' => Services::find()->where(['active' => Services::ACTIVE, 'parent_id' => 0])->orderBy('sort asc'), 'pagination' => false]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function search2($params, $id) { $query = Services::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['sort' => 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, 'parent_id' => $id, 'sort' => $this->sort, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]); $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'active', $this->active])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'picture', $this->picture])->andFilterWhere(['like', 'path_picture', $this->path_picture])->andFilterWhere(['like', 'preview_text', $this->preview_text])->andFilterWhere(['like', 'detail_text', $this->detail_text])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Services::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->where('service_status=\'Y\''); $query->andFilterWhere(['service_id' => $this->service_id, 'service_price' => $this->service_price]); $query->andFilterWhere(['like', 'service_name', $this->service_name])->andFilterWhere(['like', 'service_status', $this->service_status]); return $dataProvider; }
public function search($input) { $query = Services::query(); $columns = Schema::getColumnListing('services'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } return [$query->get(), $attributes]; }
<?php use yii\helpers\Html; use yii\grid\GridView; use app\models\Services; use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $searchModel app\models\ServicesSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Services'); $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']]; $this->params['breadcrumbs'] = Services::getListBreadcrumb($id, $this->params['breadcrumbs']); ?> <div class="col-md-2"> <?php echo $this->render('_menu'); ?> </div> <div class="col-md-10"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create Services'), ['create', 'id' => $id], ['class' => 'btn btn-success']); ?> </p> <p> <?php if ($id != 0) { if ($Services->parent_id != 0) {
/** * @return \yii\db\ActiveQuery */ public function getTransService() { return $this->hasOne(Services::className(), ['service_id' => 'trans_service_id']); }
/** * This function takes care of the submit on Edit services Page * * @param POST data * * @return same page if validation fails, else services page with success message */ public function EditServicesSubmit() { //get form inputs $input = Request::all(); //if delete button is clicked if (isset($_POST['delserv'])) { $delsName = $input['delsname']; Services::where('Service', $delsName)->delete(); return redirect('dashboard/services')->with('message', 'Record Deleted Successfully'); } else { $iServiceName = $input['Service']; //create validation input array $rules = array('Service' => 'regex:/(^[A-Za-z ]+$)+/', 'Description' => 'regex:/[A-Za-z0-9 _.,!"]+$]*/'); //use laravel validation class $validation = Validator::make($input, $rules); //redirect if validation fails if ($validation->fails()) { return redirect('dashboard/services/edit?Service=' . $iServiceName)->withErrors($validation)->withInput(); } //get post data to variables $iServiceName = $input['Service']; $iDescription = $input['Description']; try { //insert the data to services table Services::where('Service', $iServiceName)->update(['Description' => $iDescription]); return redirect('dashboard/services')->with('message', 'Record Updated Successfully'); } catch (\Illuminate\Database\QueryException $e2) { return redirect('dashboard/services')->with('message', 'Record Update Failed'); } } }
/** * @return \yii\db\ActiveQuery */ public function getTransServices() { return $this->hasMany(Services::className(), ['service_id' => 'trans_service_id'])->viaTable('transaction_detail', ['trans_id' => 'trans_id']); }
/** * This function loads the add service providers page * * * @return add service providers page with services table data */ public function AddServiceProviderLoad() { $result = Services::select('*')->get(); return view('serviceproviders.add-service-provider')->with('result', $result); }
echo date('d/m/Y', strtotime($model->trans_date)); ?> " type="text" class="form-control datepicker" id="transactions-trans_date" name="Transactions[trans_date]"/> </div> </div> </div> </div> <div class="col-md-6"> <div class="row"> <div class="col-md-12"> <div class="form-group required"> <label class="col-sm-3 control-label required" for="itemcode">Pilih Layanan</label> <div class="col-sm-9"> <?php $services = Services::find()->all(); ?> <select id="itemcode" class="form-control select2" name="itemcode"> <option value="">Pilih Layanan</option> <?php foreach ($services as $s) { ?> <option price="<?php echo $s->service_price; ?> " value="<?php echo $s->service_id; ?> "><?php echo $s->service_name; ?>
/** * This function loads the add event category view. * * * @return add event categories view with services table data */ public function AddEventCategoriesLoad() { $services = Services::distinct()->select('*')->groupBy('Service')->get(); return view('event_types.add')->with('services', $services); }
public function getServices() { return $this->hasMany(Services::className(), ['category_id' => 'id']); }
public function deleteService($id) { $service = new Services(); $service->destroy($id); newFlashMessage('test', 'Servicio eliminado'); return redirect('admin/service'); }
/** * Remove the specified resource from storage. * * @param Services $services * @return \Illuminate\Http\RedirectResponse * @throws \Exception */ public function destroy(Services $services) { $image = Attachment::where('id', $services->attachment_id); $services->delete(); $image->delete(); return redirect()->route('admin.services.index'); }
} .is_available{ color:green; } .is_not_available{ color:red; } </style> <?php use App\Models\Event_Types; use App\Models\Event_Services; use App\Models\Services; //get data from tables using EventName from URL $services = Services::distinct()->select('Service')->groupBy('Service')->get(); $result4 = Event_Services::select('Service')->where('EventName', $EventName)->get(); $result3 = Event_Types::select('*')->where('EventName', $EventName)->get(); foreach ($result3 as $ic) { $result3 = $ic->Icon; } ?> @endsection @section('header-js') @endsection @section('content') <div class="content"> <div class="container">
<div class="pricing-title"> {{$y_value}} </div> <div style="height: 86px;" class="pricing-features"> <ul class="sf-list pr-list"> <?php //choose the corresponding services in the event type $ServicesQuery = Event_Services::select('*')->where('EventName', $y_value)->get(); if ($ServicesQuery != null) { foreach ($ServicesQuery as $service) { $serv = $service->Service; $description = Services::select('*')->where('Service', $serv)->get(); //$desc = $description->Description; //echo '<li>'; foreach ($description as $d) { $desc = $d->Description; } echo "<li style='padding:2px 20px' title='" . $desc . "' >" . $service->Service . "</li>"; //echo '</li>'; } } ?> </ul> </div> <div class="pr-button">
/** * Finds the Services model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Services the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Services::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
@section('content') @section('header-css') @endsection @section('header-js') @endsection <?php $service = $_GET['Service']; use App\Models\Services; //get data from tables using Service from URL $services = Services::select('*')->where('Service', $service)->get(); foreach ($services as $y) { $ServiceName = $y->Service; $Description = $y->Description; } ?> @section('content') <div class="content"> <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-1"> <div class="panel panel-default"> <div class="col-md-12"> <br/> <center><h1>Edit Service : {{$service}} </h1></center>
/** * @return \yii\db\ActiveQuery */ public function getPriceService() { return $this->hasOne(Services::className(), ['service_id' => 'price_service_id']); }
<?php /** * Created by PhpStorm. * User: Alexander * Date: 23.03.2016 * Time: 2:34 */ use yii\widgets\Menu; use app\models\Services; ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php echo Yii::t('app', 'Sections'); ?> :</h3> </div> <div class="panel-body"> <div class="row"> <?php echo Menu::widget(['options' => ['class' => 'nav nav-pills nav-stacked ', 'style' => 'font-size:12px;'], 'submenuTemplate' => '<ul class="nav nav-pills nav-stacked" style="padding-left: 20px">{items}</ul>', 'items' => Services::getListMenu()]); ?> </div> </div> </div>