当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::select方法代码示例

本文整理汇总了PHP中Tag::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::select方法的具体用法?PHP Tag::select怎么用?PHP Tag::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


在下文中一共展示了Tag::select方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: welcome

 private function welcome()
 {
     if (LOGGED) {
         return false;
     }
     $tags = Tag::select('name')->limit(30)->findArray();
     View::set('tags', $tags);
     View::set('welcome', 1);
 }
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:9,代码来源:home.php

示例2: tags

 /**
  * Get all distinct tags attached to all posts by author.
  * Can't use hasManyThrough on ManyToMany relationships, so we do this instead.
  *
  * @return array
  */
 public function tags()
 {
     $tags = array();
     $rows = Tag::select('tags.id', 'tags.name')->join('post_tag', 'tags.id', '=', 'post_tag.tag_id')->join('posts', 'post_tag.post_id', '=', 'posts.id')->where('posts.author_id', $this->id)->groupBy('tags.id')->orderBy('tags.name')->get();
     foreach ($rows as $row) {
         $tags[] = $row;
     }
     return $tags;
 }
开发者ID:shruti222patel,项目名称:laravel-model-demo,代码行数:15,代码来源:User.php

示例3: explore

 private function explore()
 {
     // Get some tags to show as options
     $tags = Tag::select('name')->limit(30)->findArray();
     View::set('tags', $tags);
     // No tags selected
     if (empty($_GET['t']) || !Validate::tags($_GET['t'])) {
         $rows = Playlist::join('user', 'user_id = u.id', 'u')->selectMany('playlist.*', 'username')->where('published', 1)->paginate();
         Base::eagerLoadingPlaylistTags($rows);
         View::set('playlists', $rows);
         View::show('explore');
     }
     // Separate tags by spaces
     $tags = trim($_GET['t']);
     $tags = explode('/', $tags, 4);
     $tags = array_slice($tags, 0, 3);
     // Url for selected tags
     $selectedTagsUrl = implode('/', $tags);
     // Beautifys the title Tags
     $selectedTags = array();
     foreach ($tags as $key => $item) {
         // Removes empty tags
         if (empty($item)) {
             unset($tags[$key]);
             continue;
         }
         $aux = array();
         $aux['name'] = $item;
         // When one clicked will remove that tag from the query
         unset($tags[$key]);
         $aux['href'] = '/' . implode('/', $tags);
         $tags[$key] = $item;
         $selectedTags[] = $aux;
     }
     $playlists = Playlist::filter('byTags', $tags)->join('user', 'p.user_id = u.id', 'u')->selectMany('p.*', 'username');
     $count = $playlists->countDistinct('p.id');
     $playlists = $playlists->groupBy('p.id')->paginate($count);
     Base::eagerLoadingPlaylistTags($playlists);
     // View preparations
     View::set('playlists', $playlists);
     View::set('selectedTags', $selectedTags);
     View::set('selectedTagsUrl', $selectedTagsUrl);
     View::show('explore');
 }
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:44,代码来源:explore.php

示例4: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $log = new Process();
     $log->name = "make-history";
     $log->status = "running";
     $log->save();
     $today = Carbon::today();
     $topToday = array();
     $newspapers = Newspaper::select('id')->get();
     $tags = Tag::select('id')->get();
     foreach ($newspapers as $key => $n) {
         $top = $this->getTopLink($today, $n->id, false);
         if ($top) {
             $topToday[] = $top;
         }
     }
     foreach ($tags as $key => $t) {
         $top = $this->getTopLink($today, false, $t->id);
         if ($top) {
             $topToday[] = $top;
         }
     }
     $topToday = array_unique($topToday);
     //Remove links for today
     History::where('date', '=', $today)->delete();
     //Save history
     foreach ($topToday as $key => $t) {
         $this->info($t->title);
         try {
             $h = new History();
             $h->id_ref = $t->id;
             unset($t->id);
             $h->fill($t->toArray());
             $h->date = $today;
             $h->save();
         } catch (Exception $e) {
         }
     }
     $log->status = "finished";
     $log->save();
 }
开发者ID:vmariano,项目名称:shared-links-ranking,代码行数:46,代码来源:HistoryCommand.php

示例5: manage

 public function manage()
 {
     $query = Tag::select('tag_id', 'tag', 'pull_from_ig', 'status')->get();
     return View::make('manage')->with(array('querys' => $query));
 }
开发者ID:mobcomlab,项目名称:we-share,代码行数:5,代码来源:AdminController.php

示例6: array

 function _eager_load_tags($data)
 {
     $ids = array();
     foreach ($data as $content) {
         $ids[] = $content->id;
     }
     $db_config = Shutter::get_db_configuration();
     switch ($this->model) {
         case 'text':
             $join_table = $db_config['prefix'] . 'join_tags_text';
             break;
         case 'content':
             $join_table = $db_config['prefix'] . 'join_content_tags';
             break;
         case 'album':
             $join_table = $db_config['prefix'] . 'join_albums_tags';
             break;
     }
     $join_field = $this->model . '_id';
     $tag = new Tag();
     $tag->select($db_config['prefix'] . 'tags.*, ' . $join_table . '.' . $this->model . '_id as ' . $join_field)->where_related($this->model, 'id', $ids)->order_by('name ASC')->get_iterated();
     $tag_map = array();
     $tag_cache = array();
     foreach ($tag as $t) {
         if (isset($tag_cache[$t->name])) {
             $tag_as_array = $tag_cache[$t->name];
         } else {
             $tag_as_array = $t->_tag_for_output($this->model);
             $tag_cache[$t->name] = $tag_as_array;
         }
         $key = 'c' . $t->{$join_field};
         if (isset($tag_map[$key])) {
             $tag_map[$key][] = $tag_as_array;
         } else {
             $tag_map[$key] = array($tag_as_array);
         }
     }
     return $tag_map;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:39,代码来源:koken.php

示例7: edit

 /**
  * Edit a playlist
  */
 private function edit()
 {
     Base::requireLogged();
     if (LOGGED !== $this->playlist->user_id) {
         Base::requireAdmin();
     }
     // Set page title
     View::set('page_title', 'Edit playlist');
     // Set playlist
     $playlist = $this->playlist->asArray();
     $playlist['tracks'] = $this->playlist->tracks();
     $tags = $this->playlist->tags();
     if ($tags) {
         $playlist['tags'] = implode(', ', $tags);
     }
     View::set('playlist', $playlist);
     // Not submitted
     if (!isset($_POST['playlist']) && !isset($_POST['draft'])) {
         View::show('playlist/edit');
     }
     /**
      * Add playlist title and playlist description
      */
     if (!Validate::len($_POST['title'], 2, 64)) {
         $error = 'Playlist title must be between 2 and 64 chars';
     } elseif (!Validate::len($_POST['description'], 0, 512)) {
         $error = 'Playlist description must be lesser than 512 chars';
     }
     if ($error) {
         View::error('playlist/edit', $error);
     }
     // Raw HTML may enter the db but it's automatically
     // encoded at output by Mustache
     $this->playlist->title = $_POST['title'];
     $this->playlist->description = $_POST['description'];
     /**
      * Uploads cover image
      */
     if (!empty($_FILES['cover']) && $_FILES['cover']['size'] > 0) {
         Base::uploadImage($_FILES['cover'], $cover, $error);
         if ($error) {
             View::error('playlist/edit', $error);
         }
         $this->playlist->cover = $cover;
     }
     /**
      * Inserts tags into database
      */
     if (!empty($_POST['tags'])) {
         // Separates tags by commas
         $tags = strtolower($_POST['tags']);
         $tags = explode(',', $tags, 6);
         // Tag limit
         $tags = array_slice($tags, 0, 5);
         // Filter tags
         foreach ($tags as $k => &$tag) {
             if (!ADMIN && $tag === 'staff') {
                 continue;
             }
             $tag = preg_replace('/[^a-z]+/', ' ', $tag);
             $tag = trim($tag, ' ');
             // Tag must have at least 2 chars
             // And it must be lesser than 32 chars
             if (!Validate::len($tag, 1, 32)) {
                 unset($tags[$k]);
             }
         }
         if (!empty($tags)) {
             // Remove tags from PlaylistTag
             PlaylistTag::where('playlist_id', $this->playlist->id)->deleteMany();
             // Insert tags
             $sql = str_repeat(',(?)', count($tags));
             $sql[0] = ' ';
             Tag::rawExecute("INSERT IGNORE INTO tag(name) VALUES {$sql}", $tags);
             // Get inserted tags ids and point them to the new playlist
             $tags = Tag::select('id')->whereIn('name', $tags)->findMany();
             foreach ($tags as $tag) {
                 $link = PlaylistTag::create();
                 $link->playlist_id = $this->playlist->id;
                 $link->tag_id = $tag->id;
                 $link->save();
             }
         }
     }
     // Published status
     $this->playlist->published = isset($_POST['playlist']);
     /**
      * Add tracks into db
      */
     if (!isset($_POST['tracks'])) {
         $error = 'You can\'t publish without any tracks';
         $this->playlist->published = 0;
     } else {
         if (is_array($_POST['tracks'])) {
             $max = Base::$g['playlist_max_tracks'];
             $min = Base::$g['playlist_min_tracks'];
             $tracks = $_POST['tracks'];
//.........这里部分代码省略.........
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:101,代码来源:playlist.php

示例8: die

 *   NOALYSS is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_tag.php';
ob_start();
$tag = new Tag($cn);
$tag->select();
//------------------- Propose to add a tag
$js = sprintf("onclick=\"show_tag('%s','%s','%s','j')\"", Dossier::id(), '', '-1');
echo HtmlInput::button("tag_add", _("Ajout d'un tag"), $js);
$response = ob_get_clean();
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl></ctl>
<code>{$html}</code>
</data>
EOF;
exit;
开发者ID:Kloadut,项目名称:noalyss_ynh,代码行数:31,代码来源:ajax_tag_list.php

示例9: getSuggestedTags

 public function getSuggestedTags()
 {
     $keyword = Input::get('keyword');
     $tags = Tag::select('id', 'tag')->orderBy('tag', 'asc')->where('tag', 'LIKE', '%' . $keyword . '%')->get();
     return Response::json(array('tags' => $tags));
 }
开发者ID:wxdublin,项目名称:malwaRE,代码行数:6,代码来源:HomeController.php

示例10: foreach

echo Tag::pre(Tag::code('Tag::$codeFormat = true; // default'));
echo Tag::h2('1. Html4 tags.');
$plain = TagNodes::create();
foreach ($html4_tags as $tag_name => $flg) {
    $plain->append(Tag::create($tag_name, 'contents'));
}
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
echo Tag::h2('2. Table.');
$plain = Tag::table(Tag::tr(Tag::td(), Tag::td()), Tag::tr(Tag::td(), Tag::td()));
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
echo Tag::h2('3. List.');
$plain = Tag::ul(Tag::li(), Tag::li());
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
$plain = Tag::ul(Tag::li('aaa'), Tag::li('bbb'));
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
echo Tag::h2('4. Block and inline.');
$plain = Tag::div(Tag::div(), Tag::div());
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
$plain = Tag::div(Tag::span(), Tag::span());
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
$plain = Tag::span(Tag::span(), Tag::span());
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
$plain = Tag::span(Tag::span(), Tag::br());
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
$plain = Tag::select(Tag::option('a'), Tag::option('b'), Tag::option('c'));
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
echo Tag::h2('5. Style and script.');
$plain = Tag::head(Tag::style('a { color: red; }'), Tag::script('function(){
    alert("warning!");
}'));
echo Tag::pre(Tag::code(htmlspecialchars($plain)));
开发者ID:primalbase,项目名称:html-tag2,代码行数:31,代码来源:example3.php

示例11: query

 /**
  * Get the query object to be processed by datatables.
  *
  * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
  */
 public function query()
 {
     $articles = Tag::select('articles.*', 'categories.title as category_title')->join('categories', 'categories.id', '=', 'articles.category_id');
     return $this->applyScopes($articles);
 }
开发者ID:yajra,项目名称:cms-core,代码行数:10,代码来源:TagsDataTable.php

示例12: stringToIdTags

 public function stringToIdTags($string)
 {
     $string = preg_replace('/\\s\\s+/', ' ', $this->strtolower_utf8(trim($string)));
     $array_string = explode(' ', $string);
     $array_tags_id = array();
     $index = 0;
     foreach ($array_string as $key => $value) {
         $array_id = Tag::select('id')->distinct()->where("mo_ta_tags", "like", $value . "%")->orWhere("mo_ta_tags", "like", "%" . $value)->orWhere("mo_ta_tags", "like", "%" . $value . "%")->get();
         if (count($array_id) != 0) {
             foreach ($array_id as $id) {
                 $array_tags_id[$index++] = $id->id;
             }
         }
     }
     return array_unique($array_tags_id);
 }
开发者ID:ngogiangthanh,项目名称:code-nien-luan-ktpm-k36,代码行数:16,代码来源:QuanLyQuanLyBaiViet.php

示例13: array

<div>
    <label for="product_types_id">Product Type</label>
    <?php 
echo Tag::select(array("product_types_id", $productTypes, "using" => array("id", "name"), "useDummy" => true));
?>
</div>

开发者ID:aodkrisda,项目名称:phalcon-code,代码行数:6,代码来源:tutorial-invo-704.php

示例14: getTags

 public function getTags()
 {
     return Response::json(Tag::select('id', 'name', 'color')->orderBy('name', 'ASC')->get());
 }
开发者ID:vmariano,项目名称:shared-links-ranking,代码行数:4,代码来源:ApiController.php


注:本文中的Tag::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。