本文整理汇总了PHP中app\Tag::All方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::All方法的具体用法?PHP Tag::All怎么用?PHP Tag::All使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Tag
的用法示例。
在下文中一共展示了Tag::All方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update a new Note: load date and forward to view
*
* @param Request $request, Note $note
* @return view
*/
public function update(Request $request, Note $note)
{
$categories = Category::All(['id', 'name']);
$tags = Tag::All(['id', 'name', 'css_class']);
$user = User::find($request->user()->id);
//get next id
$notes = DB::table('notes')->leftjoin('categories', 'notes.category_id', '=', 'categories.id')->select('notes.id as id');
//handle categories
$ses_category_id = $request->session()->get('note_category_id');
if ($ses_category_id) {
$notes->where('category_id', '=', $ses_category_id);
}
//handle search tags
$search = $request->session()->get('note_search');
if (strlen($search) > 0) {
$search_array = explode(",", $search);
$tags_sel = Tag::find($search_array);
foreach (explode(",", $search) as $s) {
$notes->where('tag_ids', 'like', "%," . $s . ",%");
}
}
//handle search
if ($request->btn_search == "s") {
if ($request->search_text) {
$request->session()->put('note_search_text', $request->search_text);
} else {
$request->session()->forget('note_search_text');
}
}
$search_text = $request->session()->get('note_search_text');
if (strlen($search_text) > 0) {
$notes->where(function ($query) use($search_text) {
$query->where('notes.title', 'like', "%" . $search_text . "%")->orWhere('notes.description', 'like', "%" . $search_text . "%");
});
}
//handle sort order
$order = $request->session()->get('note_order');
if (!$order) {
$order = 'title';
}
//handle sort direction
$dir = $request->session()->get('note_dir');
if (!$dir) {
$dir = 'ASC';
}
$pagination_number = $request->session()->get('pagination_number');
$notes = $notes->orderBy('notes.' . $order, $dir)->orderBy('notes.title', 'ASC')->paginate($pagination_number);
$previous_id = 0;
$next_id = 0;
$counter = 0;
$found = false;
foreach ($notes as $temp) {
if ($found) {
$next_id = $temp->id;
break;
}
if ($temp->id == $note->id) {
$found = true;
}
$counter++;
if (!$found) {
$previous_id = $temp->id;
}
}
return view('notes.update', ['categories' => $categories, 'note' => $note, 'category_id' => False, 'tags' => $tags, 'tags_sel' => $tags_sel = Tag::find(explode(",", $note->tag_ids)), 'previous_id' => $previous_id, 'next_id' => $next_id, 'counter' => $counter, 'total' => count($notes), 'page' => $request->session()->get('note_page'), 'filetab' => $request->filetab])->withNote($note);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$tags = Tag::All();
//view of all tags and some games under each
}
示例3: update
/**
* Update a new task: load date and forward to view
*
* @param Request $request, Task $task
* @return view
*/
public function update(Request $request, Person $person)
{
$user = User::find($request->user()->id);
$categories = Category::where('is_note', '=', 0)->orderBy('seq')->get();
$tags = Tag::All(['id', 'name', 'css_class']);
$parents = Person::All(['id', 'lastname', 'surname']);
//get next id
$persons = DB::table('persons')->leftjoin('categories', 'persons.category_id', '=', 'categories.id')->select('persons.id as id');
//handle categories
$ses_category_id = $request->session()->get('person_category_id');
if ($ses_category_id) {
$persons->where('category_id', '=', $ses_category_id);
}
//handle search tags
$search = $request->session()->get('person_search');
if (strlen($search) > 0) {
$search_array = explode(",", $search);
$tags_sel = Tag::find($search_array);
foreach (explode(",", $search) as $s) {
$persons->where('tag_ids', 'like', "%" . $s . "%");
}
}
//handle search text
$search_text = $request->session()->get('person_search_text');
if (strlen($search_text) > 0) {
$persons->where('persons.searchname', 'like', "%" . $search_text . "%");
}
//handle sort order
$order = $request->session()->get('person_order');
if (!$order) {
$order = 'lastname';
}
//handle sort direction
$dir = $request->session()->get('person_dir');
if (!$dir) {
$dir = 'ASC';
}
//handle filters
$filter_parent = $request->session()->get('filter_parent');
if ($filter_parent == 1) {
$persons->where('parent_id', '=', 0);
}
$filter_child = $request->session()->get('filter_child');
if ($filter_child == 1) {
$persons->where('parent_id', '>', 0);
}
$filter_birthday = $request->session()->get('filter_birthday');
if ($filter_birthday == 1) {
$persons->where('birthday', '>', 0);
$order = 'birthday';
}
$pagination_number = $request->session()->get('pagination_number');
$persons = $persons->orderBy($order, $dir)->orderBy('searchname')->paginate($pagination_number);
$previous_id = 0;
$next_id = 0;
$counter = 0;
$found = false;
foreach ($persons as $temp) {
if ($found) {
$next_id = $temp->id;
break;
}
if ($temp->id == $person->id) {
$found = true;
}
$counter++;
if (!$found) {
$previous_id = $temp->id;
}
}
$tags_sel = Tag::find(explode(",", $person->tag_ids));
$children = Person::where('parent_id', '=', $person->id)->orderBy('searchname')->get();
return view('persons.update', ['categories' => $categories, 'person' => $person, 'category_id' => False, 'tags' => $tags, 'tags_sel' => $tags_sel, 'parents' => $parents, 'next_id' => $next_id, 'previous_id' => $previous_id, 'counter' => $counter, 'total' => count($persons), 'children' => $children, 'page' => $request->session()->get('person_page')])->withPerson($person);
}