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


PHP Tag::all方法代码示例

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


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

示例1: index

 /**
  * Display a listing of latest questions.
  *
  * @return Response
  */
 public function index()
 {
     $sort = array('name' => '', 'direction' => '');
     switch (Input::get('sort')) {
         case 'newest':
             $sort['name'] = 'created_at';
             $sort['direction'] = 'desc';
             break;
         case 'oldest':
             $sort['name'] = 'created_at';
             $sort['direction'] = 'asc';
         case 'most viewed':
             $sort['name'] = 'view_count';
             $sort['direction'] = 'desc';
             break;
         default:
             $sort['name'] = 'created_at';
             $sort['direction'] = 'desc';
             break;
     }
     $questions = Post::orderBy($sort['name'], $sort['direction'])->where('post_type_id', '=', '1')->paginate(10);
     $tags = Tag::all();
     $data = array('questions' => $questions, 'tags' => $tags);
     // return var_dump($posts);
     return View::make('public.questions.index', $data);
 }
开发者ID:UnderDogg,项目名称:StackOverflow-Clone,代码行数:31,代码来源:QuestionsController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $photo = Photo::find($id);
     $tagged_photo = $photo->tags()->get();
     $tags = Tag::all();
     return View::make('photos.show', compact('photo', 'tags', 'tagged_photo'));
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:13,代码来源:PhotosController.php

示例3: all

 public function all()
 {
     $tags = Tag::all();
     $result = array();
     foreach ($tags as $tag) {
         $result[] = array('id' => $tag->id, 'label' => $tag->name, 'value' => $tag->name);
     }
     return Response::json($result);
 }
开发者ID:wcoder,项目名称:basont,代码行数:9,代码来源:TagController.php

示例4: getIdNamePair

 /**
  *
  * @return Array
  */
 public static function getIdNamePair()
 {
     $tags = array();
     $collection = Tag::all();
     foreach ($collection as $tag) {
         $tags[$tag->id] = $tag->name;
     }
     return $tags;
 }
开发者ID:rebekahheacock,项目名称:dwa15-archive,代码行数:13,代码来源:Tag.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $post = Post::where('id', '=', $id)->first();
     $answer = Post::where('id', '=', $post->accepted_answer_id)->first();
     $answers = Post::with(array('votes'))->where('parent_id', '=', $post->id)->where('id', "<>", $post->accepted_answer_id)->get();
     $tags = Tag::all();
     $data = array('post' => $post, 'answer' => $answer, 'answers' => $answers, 'tags' => $tags);
     return View::make('public.question.index', $data);
 }
开发者ID:UnderDogg,项目名称:StackOverflow-Clone,代码行数:15,代码来源:QuestionController.php

示例6: tags

 /**
  * Теги
  */
 public function tags()
 {
     $query = Request::input('query');
     $tags = Tag::all(['conditions' => ['`name` LIKE ?', '%' . $query . '%'], 'select' => 'count(*) as cnt, name', 'group' => 'name', 'order' => 'cnt DESC', 'limit' => 10]);
     $sortTags = [];
     foreach ($tags as $tag) {
         //$sortTags[] = ['name' => $tag->name, 'count' => $tag->cnt];
         $sortTags[] = $tag->name;
     }
     exit(json_encode($sortTags));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:14,代码来源:NewsController.php

示例7: array

<?php

require __DIR__ . '/../../../init.php';
$error = array();
if (empty($_GET['name']) && empty($_POST['name'])) {
    redirect();
}
$name = isset($_GET['name']) ? $_GET['name'] : $_POST['name'];
$trick = new Trick($db, $user->get_id());
$tag = new Tag($db, $user->get_id());
$tricks = $trick->by_name($name);
$tricks_old = array_select_prefix($tricks);
$tags_old = array_select_key($tricks, 'tag_id');
$stances_old = array_select_key($tricks, 'stance');
$directions_old = array_select_key($tricks, 'direction');
$tags_all = $tag->all();
$tags_echo = tag_ids_checkbox_ul($tags_all, $tags_old);
if (!$tags_echo) {
    redirect('/tag/create/index.php?no_tags=1');
}
if (isset($_POST['name'])) {
    if (strlen(validate_name($_POST['name'])) > 0) {
        $error['name'] = validate_name($_POST['name']);
    }
    if (isset($_POST['tag_ids']) && count($_POST['tag_ids']) == 0) {
        $error['tag_ids'] = 'no tags were selected';
    }
    if (count($error) == 0) {
        $prefixes = generate_prefixes(array_keys($_POST['stance']), array_keys($_POST['direction']), $_POST['tag_ids']);
        $delete_tricks = compare_prefixes($tricks_old, $prefixes);
        $create_tricks = compare_prefixes($prefixes, $tricks_old);
开发者ID:doodzik,项目名称:homespot_legacy,代码行数:31,代码来源:index.php

示例8:

@extends('admin.layouts.default')
<?php 
$tags = Tag::all();
?>

{{-- Web site Title --}}
@section('title')
  Admin | Tags 
@stop


@section('scripts')

@stop

{{-- Content --}}
@section('content')
  
  <h2 class="page-header">Tags</h2>

  <div class="row">
	<div class="col-md-6">
		
		<div class="well">
	      {{Form::open(['url'=>'/admin/tags', 'method'=>'POST', 'id'=>'create-form'])}}
	      
	       	<input type="hidden" value="{{Auth::user()->id}}" name="user_id">

	        <!-- Name -->
	        <div class="form-group">
	          	<label for="name">Name</label>
开发者ID:vanderlin,项目名称:halp,代码行数:31,代码来源:index.blade.php

示例9: checkSandstormUsers

 public function checkSandstormUsers()
 {
     if (Config::get('paperwork.emergency_export') && DB::table('migrations')->where('batch', '=', 1)->count() == Config::get('paperwork.emergency_export_count')) {
         $credentials = ["username" => "sandstorm_dummy", "password" => "sandstorm_dummy"];
         if (Auth::attempt($credentials)) {
             $settings = Setting::where('user_id', '=', Auth::user()->id)->first();
             Session::put('ui_language', $settings->ui_language);
             return View::make('user.emergency_export');
         }
     } else {
         // get permission via HTTP_X_SANDSTORM header
         $sandstorm_permissions = $_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'];
         // Only when we are admin, we check and create users
         if ($sandstorm_permissions == "admin,write,read") {
             // check for admin user
             if (User::where('username', '=', 'sandstorm_admin')->count() == 0) {
                 $sandstorm_admin = User::create(Input::except('_token', 'password_confirmation', 'ui_language'));
                 if ($sandstorm_admin) {
                     //make the first user an admin
                     $sandstorm_admin->firstname = "sandstorm_admin";
                     $sandstorm_admin->lastname = " ";
                     $sandstorm_admin->username = "sandstorm_admin";
                     $sandstorm_admin->password = "sandstorm_admin";
                     $sandstorm_admin->is_admin = 1;
                     $sandstorm_admin->save();
                     $setting_sandstorm_admin = Setting::create(['ui_language' => 'en', 'user_id' => $sandstorm_admin->id]);
                 }
             } else {
                 $sandstorm_admin = User::where('username', '=', 'sandstorm_admin');
             }
             // Then the read & write  user
             if (User::where('username', '=', 'sandstorm_readwrite')->count() == 0) {
                 $sandstorm_readwrite = User::create(Input::except('_token', 'password_confirmation', 'ui_language'));
                 if ($sandstorm_readwrite) {
                     $sandstorm_readwrite->firstname = "sandstorm_readwrite";
                     $sandstorm_readwrite->lastname = " ";
                     $sandstorm_readwrite->username = "sandstorm_readwrite";
                     $sandstorm_readwrite->password = "sandstorm_readwrite";
                     $sandstorm_readwrite->save();
                     $setting_sandstorm_readwrite = Setting::create(['ui_language' => 'en', 'user_id' => $sandstorm_readwrite->id]);
                 }
             } else {
                 $sandstorm_readwrite = User::where('username', '=', 'sandstorm_readwrite');
             }
             // Then the read only  user
             if (User::where('username', '=', 'sandstorm_readonly')->count() == 0) {
                 $sandstorm_readonly = User::create(Input::except('_token', 'password_confirmation', 'ui_language'));
                 if ($sandstorm_readonly) {
                     $sandstorm_readonly->firstname = "sandstorm_readonly";
                     $sandstorm_readonly->lastname = " ";
                     $sandstorm_readonly->username = "sandstorm_readonly";
                     $sandstorm_readonly->password = "sandstorm_readonly";
                     $sandstorm_readonly->save();
                     $setting_sandstorm_readonly = Setting::create(['ui_language' => 'en', 'user_id' => $sandstorm_readonly->id]);
                 }
             } else {
                 $sandstorm_readonly = User::where('username', '=', 'sandstorm_readonly');
             }
         }
         // Now that the required users are there we create the default
         if (Notebook::all()->count() == 0 && Tag::all()->count() == 0 && Note::all()->count() == 0) {
             // Notebook ...
             $notebookCreate = new Notebook();
             $notebookCreate->title = Lang::get('notebooks.welcome_notebook_title');
             $notebookCreate->save();
             $notebookCreate->users()->attach($sandstorm_readonly->id, ['umask' => PaperworkHelpers::UMASK_READONLY]);
             $notebookCreate->users()->attach($sandstorm_readwrite->id, ['umask' => PaperworkHelpers::UMASK_READWRITE]);
             $notebookCreate->users()->attach($sandstorm_admin->id, ['umask' => PaperworkHelpers::UMASK_OWNER]);
             // Tag ...
             $tagCreate = new Tag();
             $tagCreate->title = Lang::get('notebooks.welcome_note_tag');
             $tagCreate->visibility = 1;
             $tagCreate->user_id = $sandstorm_admin->id;
             $tagCreate->save();
             // Note ...
             $noteCreate = new Note();
             $versionCreate = new Version(['title' => Lang::get('notebooks.welcome_note_title'), 'content' => Lang::get('notebooks.welcome_note_content'), 'content_preview' => mb_substr(strip_tags(Lang::get('notebooks.welcome_note_content')), 0, 255), 'user_id' => $sandstorm_admin->id]);
             $versionCreate->save();
             $noteCreate->version()->associate($versionCreate);
             $noteCreate->notebook_id = $notebookCreate->id;
             $noteCreate->save();
             $noteCreate->users()->attach($sandstorm_readonly->id, ['umask' => PaperworkHelpers::UMASK_READONLY]);
             $noteCreate->users()->attach($sandstorm_readwrite->id, ['umask' => PaperworkHelpers::UMASK_READWRITE]);
             $noteCreate->users()->attach($sandstorm_admin->id, ['umask' => PaperworkHelpers::UMASK_OWNER]);
             $noteCreate->tags()->sync([$tagCreate->id]);
         }
         // login
         if ($sandstorm_permissions == "read") {
             $credentials = ["username" => "sandstorm_readonly", "password" => "sandstorm_readonly"];
         }
         if ($sandstorm_permissions == "write,read") {
             $credentials = ["username" => "sandstorm_readwrite", "password" => "sandstorm_readwrite"];
         }
         if ($sandstorm_permissions == "admin,write,read") {
             $credentials = ["username" => "sandstorm_admin", "password" => "sandstorm_admin"];
         }
         if (Auth::attempt($credentials)) {
             $settings = Setting::where('user_id', '=', Auth::user()->id)->first();
             Session::put('ui_language', $settings->ui_language);
             return Redirect::route("/");
//.........这里部分代码省略.........
开发者ID:neynah,项目名称:paperwork,代码行数:101,代码来源:UserController.php

示例10: index

 /**
  * Display a listing of tags
  *
  * @return Response
  */
 public function index()
 {
     $tags = Tag::all();
     return View::make('tags.index', compact('tags'));
 }
开发者ID:ZeshanNSegal,项目名称:blog.dev,代码行数:10,代码来源:TagsController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $tags = Tag::all();
     return view('admin.tag.index')->withTags($tags);
 }
开发者ID:jzfan,项目名称:laravel-51-blog,代码行数:10,代码来源:TagController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return Response::json(array('success_code' => 'OK', 'data' => Tag::all()->toArray()));
 }
开发者ID:rhalff,项目名称:vdragon-api,代码行数:9,代码来源:TagController.php

示例13: getTags

 private function getTags($lessonId)
 {
     //return  $lessonId ? Lesson::find($lessonId)->tags : Tag::all();
     return $lessonId ? Lesson::findOrFail($lessonId)->tags : Tag::all();
 }
开发者ID:rudihartomo,项目名称:Laravel-RestAPI,代码行数:5,代码来源:TagsController.php

示例14: array

<?php

include '../../inc/init.inc';
$list = array();
foreach (Tag::all()->asArray() as $Tag) {
    $list[] = "&quot; <span class='label'>" . $Tag->name . "</span> &quot;";
}
if (count($list) > 0) {
    $res->tagList = implode(',', $list);
}
$res->useTemplate();
开发者ID:Osin,项目名称:Intranet,代码行数:11,代码来源:question.create.php

示例15: show

 /**
  * Display the specified resource.
  * GET /blogs/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $blog = Blog::find($id);
     $tags = Tag::all();
     return View::make('blogs.show', compact('blog', 'tags'));
 }
开发者ID:shankargiri,项目名称:taylor_latest,代码行数:13,代码来源:BlogsController.php


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