예제 #1
0
파일: TagsSearch.php 프로젝트: raguila/islc
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tags::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['TagID' => $this->TagID]);
     $query->andFilterWhere(['like', 'TagDescription', $this->TagDescription]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tags::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(['id' => $this->id, 'created' => $this->created, 'modified' => $this->modified]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tags::getDb()->cache(function ($db) {
         $query = Tags::find();
         $query->joinWith(['tagType', 'parentTag']);
         return $query;
     });
     $_columns = [Tags::tableName() . '.id', Tags::tableName() . '.tag_name_' . Yii::$app->language, Tags::tableName() . '.tag_type'];
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->select($_columns);
     $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, 'create_date' => $this->create_date]);
     $query->andFilterWhere(['like', 'tag_name_ar', $this->tag_name_ar])->andFilterWhere(['like', 'tag_name_en', $this->tag_name_en])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'type_name', $this->tag_type]);
     //->andFilterWhere(['like', 'CONCAT(full_name,username)', $this->created_by]);
     return $dataProvider;
 }
예제 #4
0
 public function getTag($aliasOrId)
 {
     $tag = Tags::where('id', $aliasOrId)->orWhere('tag_name', $aliasOrId)->firstOrFail();
     $diary = Tags::find($tag->id)->diary()->where('diary.status', 1)->orderBy('created_at', 'desc')->paginate(10);
     return view('site.diary.diary', ['pageInfo' => ['pageLogo' => 'diary', 'siteTitle' => 'Diary by Tag | ' . $tag->tag_name, 'pageHeading' => 'Diary | ' . $tag->tag_name, 'pageHeadingSlogan' => 'I write here what I learn'], 'data' => $diary]);
 }
예제 #5
0
파일: routes.php 프로젝트: lyovkin/v2board
 * Items category
 */
Route::resource('items_category', 'ItemsCategoryController');
Route::post('getShop', ['uses' => 'ItemsCategoryController@getShop', 'as' => 'getShop']);
$router->post('/ads/flush', 'AdsController@flush');
$router->post('/questions/flush', 'QuestionsController@flush');
$router->post('/questions/upload', 'QuestionsController@store');
$router->post('/questions/{id}', 'QuestionsController@show');
$router->bind('pagename', function ($id) {
    return \AppAdmin\Models\PageName::find($id);
});
$router->bind('categories', function ($id) {
    return \App\Models\Category::find($id);
});
$router->bind('tags', function ($id) {
    return \App\Models\Tags::find($id);
});
$router->bind('ads', function ($id) {
    return \App\Models\Advertisement::find($id);
});
$router->bind('country', function ($title) {
    return \App\Models\Country::where('title', '=', $title)->first();
});
/**
 * PROFILE
 */
$router->bind('profile', function ($user_name) {
    $user = \App\Models\User::where('user_name', $user_name)->first();
    if (!$user) {
        $user = \App\Models\User::where('user_name', Auth::user()->user_name)->first();
    }
예제 #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $data = $request->all();
     unset($data['_token']);
     try {
         Tags::find($id)->update($data);
         return redirect()->action('Admin\\TagsController@index')->with(array('dialog' => array('title' => '修改标签成功', 'message' => $data)));
     } catch (\Exception $e) {
         return redirect()->back()->withErrors(['error' => '修改标签失败, 请重试'])->with($data);
     }
 }
예제 #7
0
파일: Tags.php 프로젝트: Crocodile26/php-1
 public static function getBlogsByTag($tag)
 {
     $list = Tags::find()->where(['name' => $tag])->select(['blog_id'])->asArray()->all();
     return self::format($list);
 }
예제 #8
0
파일: Tags.php 프로젝트: abutouq/video
 /**
  * @return ActiveQuery | array
  */
 public static function getTagsList()
 {
     $query = Tags::find()->where(['status' => 'active'])->all();
     return ArrayHelper::map($query, 'id', 'tag_name_' . \Yii::$app->language);
 }