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


PHP Article::select方法代码示例

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


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

示例1: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('eloquent.saving*', function ($model) {
         if ($model instanceof Article) {
             $articles = Article::select('slug')->get();
             $slug = str_slug($model->title);
             $i = 0;
             do {
                 $flag = false;
                 foreach ($articles as $article) {
                     if ($article->slug == $slug) {
                         $flag = true;
                         $slug .= "-" . $i;
                         ++$i;
                     }
                 }
             } while ($flag);
             $model->slug = $slug;
         } else {
             if ($model instanceof Member) {
             } else {
                 if ($model instanceof Command) {
                 }
             }
         }
     });
 }
开发者ID:valiknet18,项目名称:FootballNewsApp,代码行数:32,代码来源:AppServiceProvider.php

示例2: scopeSearch

 /**
  * Display the home page.
  *
  * @param Request $requests
  *
  */
 public function scopeSearch(Request $requests)
 {
     $keyword = $requests->get('q');
     $results = null;
     if (isset($keyword) && trim($keyword) != "") {
         $results = Article::select('id', 'title', 'intro', 'page_image')->where('title', 'LIKE', '%' . $keyword . '%')->where('is_checked', true)->published()->paginate(10);
     }
     return view('front.search')->with('articles', $results);
 }
开发者ID:smile-zhao,项目名称:Laravel5.1_Example,代码行数:15,代码来源:UserController.php

示例3: excelArticles

 /**
  * Exporta el Listado de todos los articulos en formato Excel
  */
 public function excelArticles()
 {
     Excel::create('Maestro de Artículos', function ($excel) {
         $excel->sheet('Articulos', function ($sheet) {
             $articles = Article::select('product_code', 'name', 'active', 'barcode')->orderBy('name')->get();
             $sheet->fromArray($articles);
         });
     })->export('xlsx');
 }
开发者ID:johanWP,项目名称:pandora,代码行数:12,代码来源:ReportsController.php

示例4: getAjaxTags

 /**
  * get tags ajax
  */
 public function getAjaxTags(Request $request)
 {
     $tags = Article::select('meta_key')->where('meta_key', 'LIKE', '%' . $request->input('text') . '%')->take(20)->get();
     $results = array();
     $output = '<ul>';
     if (count($tags) > 0) {
         foreach ($tags as $tag) {
             $t = explode(', ', $tag->meta_key);
             $result = preg_grep('~' . $request->input('text') . '~', $t);
             $result = reset($result);
             if (!empty($result)) {
                 $results[] = $result;
             }
         }
         if (count($results) > 0) {
             foreach (array_unique($results) as $res) {
                 $output .= '<li data-name="' . $res . '">' . $res . '</li>';
             }
         }
     } else {
         return 0;
     }
     $output .= '</ul>';
     return $output;
 }
开发者ID:Vatia13,项目名称:gbtimes,代码行数:28,代码来源:ArticlesController.php

示例5: datas

 /**
  * article datas.
  *
  * @return \Illuminate\Http\Response
  */
 public function datas()
 {
     return Datatables::of(Article::select('*'))->make(true);
 }
开发者ID:lavenkin,项目名称:bugblog,代码行数:9,代码来源:ArticleController.php

示例6: showSerialsList

 public function showSerialsList(Article $article, $slug)
 {
     $catName = Cat::select('name')->where('slug', $slug)->take(1)->get();
     $movies = $article->select('title', 'img', 'head', 'body', 'slug')->bycatslug($slug)->language()->published()->latest()->take(get_setting('pagination_num'))->get();
     return view('components.lists.serials', compact('movies', 'catName'));
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:6,代码来源:WelcomeController.php

示例7: home

 public function home(Article $article)
 {
     $articles = $article->select('title')->get();
     return view('home')->with('articles', $articles);
 }
开发者ID:tfinnamore,项目名称:lbb,代码行数:5,代码来源:ArticleController.php

示例8: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $page = Article::findOrFail($id);
     $this->translate_slug = $page->translate_slug;
     $tr = Article::select('lang')->where('lang', '!=', $page->lang)->where(function ($query) {
         return $query->where('slug', '=', $this->translate_slug)->orWhere('translate_slug', '=', $this->translate_slug);
     })->groupBy('id')->get()->toArray();
     $translates = array_pluck($tr, 'lang');
     return view('admin.pages.edit', compact('page', 'translates'));
 }
开发者ID:Vatia13,项目名称:gbtimes,代码行数:16,代码来源:PagesController.php

示例9: similars

 public function similars($limit = 4)
 {
     return Article::select('id', 'title', 'slug', 'image_src')->where(['category_id' => $this->category_id, 'state' => 1])->where('id', '<>', $this->id)->orderByRaw("RANDOM()")->take($limit)->get();
 }
开发者ID:OlegGetm,项目名称:abs_lara,代码行数:4,代码来源:Article.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $pages = Article::select('id', 'title', 'lang')->latest()->maincat([1])->paginate(get_setting('pagination_num'));
     return view('admin.pages.index', compact('pages'));
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:10,代码来源:PagesController.php

示例11: newsAuthor

 public function newsAuthor($author)
 {
     $article = new Article();
     $items = Article::select('id', 'body', 'title', 'head', 'published_at', 'slug', 'author', 'translate_slug', 'img', 'lang')->where('author', $author)->published()->getcat(55)->language()->latest()->take(get_setting('pagination_num'))->get();
     $count = Article::where('author', $author)->published()->getcat(55)->language()->count();
     return view('theme.pages.view.author', compact('items', 'article', 'count', 'author'));
 }
开发者ID:Vatia13,项目名称:gbtimes,代码行数:7,代码来源:WelcomeController.php

示例12: pageWidget

 function pageWidget($slug, $more = false, $min, $tags = array(), $title = true)
 {
     global $registry;
     $output = '';
     $registry['slug'] = $slug;
     //Cache::pull($registry['slug']);
     $entry = Cache::remember($registry['slug'], $min, function () {
         global $registry;
         return \App\Article::select('slug', 'title', 'body')->where('slug', $registry['slug'])->first();
     });
     if (count($entry) > 0) {
         if ($title == true) {
             $output .= '<div class="rub-title-gray"><a href="/' . $slug . '"><div><h3>' . $entry->title . '</h3></div></a></div>';
         }
         if (count($tags) > 0) {
             $explode = explode('<!-- pagebreak -->', $entry->body);
             if (count($explode) > 0) {
                 foreach ($tags as $key => $i) {
                     $output .= strip_tags($explode[$key]) . '<br>';
                 }
             }
         } else {
             $output .= $entry->body;
         }
         if ($more == true) {
             $output .= ' <a href="/' . $slug . '"><b>' . trans('all.fully') . '...</b></a>';
         }
     }
     return $output;
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:30,代码来源:widgets.php

示例13: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $articleId = $this->route('article');
     $isChecked = Article::select('is_checked')->where('id', $articleId)->first();
     return $isChecked->is_checked !== 1;
 }
开发者ID:smile-zhao,项目名称:Laravel5.1_Example,代码行数:11,代码来源:ArticleUpdateRequest.php


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