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


PHP Article::where方法代码示例

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


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

示例1: article

 /**
  * Страница новости
  * @param Request $request
  * @param $alias
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function article(Request $request, $alias)
 {
     $article = Article::where('alias', $alias)->first();
     if (is_null($article)) {
         abort(404, 'Новость  не найдена');
     }
     return view('pages/article', ['article' => $article]);
 }
开发者ID:oiljin,项目名称:newsportal,代码行数:14,代码来源:ArticlesController.php

示例2: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     //定时任务
     $schedule->call(function () {
         Log::info('1111111');
         Article::where('published_time', '<', date('Y-m-d H:i:s'))->update(['is_checked' => 1]);
     })->everyMinute();
 }
开发者ID:nutsdo,项目名称:nong-store,代码行数:15,代码来源:Kernel.php

示例3: brokers

 public function brokers()
 {
     $category = Role::find(Config::get('constants.ROLE_BROKER'));
     $results = Article::where('category_id', '=', $category->id)->paginate(18);
     if (Request::ajax()) {
         return Response::json(View::make('articles.category')->withResults($results)->render());
     }
     return View::make('articles.category')->withCategory($category)->withArticles($results);
 }
开发者ID:remix101,项目名称:compex,代码行数:9,代码来源:ArticlesController.php

示例4: detail

 public function detail($slag)
 {
     $article = Article::where('slag', $slag)->findOrFail();
     if (!Article::find($article->id + 1)) {
         $article->max = true;
     } else {
         $article->max = false;
     }
     $categories = Category::all();
     return view('article.detail')->withArticle($article)->withCategories($categories)->withId($id);
 }
开发者ID:Albertao,项目名称:myblog,代码行数:11,代码来源:ArticleController.php

示例5: index

 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function index(Request $request)
 {
     $projects = Article::where('type', 'page')->orderBy('sort_order')->get();
     foreach ($projects as $project) {
         $services = explode(',', $project->services);
         $services_list = '<ul>';
         foreach ($services as $service) {
             $services_list .= '<li>' . $service . '</li>';
         }
         $services_list .= '</ul>';
         $project->services = $services_list;
         $project->logos = ProjectLogo::where('article_id', $project->id)->get();
         $project->images = ProjectImage::where('article_id', $project->id)->get();
     }
     $email = Option::where('key', 'contact.email')->first()->value;
     $phone = Option::where('key', 'contact.phone')->first()->value;
     $data = array('projects' => $projects, 'email' => $email, 'phone' => $phone);
     return view('portfolio', $data);
 }
开发者ID:Peterabsolon,项目名称:DIW,代码行数:24,代码来源:PortfolioController.php

示例6: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @return void
  */
 public function boot()
 {
     parent::boot();
     Route::bind('article', function ($slug) {
         if (!Auth::user()) {
             return Article::published()->slug($slug)->first();
         }
         return Article::where('slug', $slug)->first() ?: Article::findOrFail((int) $slug);
     });
     Route::bind('tag', function ($slug) {
         if (!Auth::user()) {
             return Tag::slug($slug)->first();
         }
         return Tag::where('slug', $slug)->first() ?: Tag::findOrFail((int) $slug);
     });
     Route::bind('page', function ($id) {
         return Page::find($id);
     });
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:24,代码来源:RouteServiceProvider.php

示例7: show

 public function show($id)
 {
     Article::where('id', $id)->increment('views');
     //阅读量加1
     $article = Article::with(['comments' => function ($query) {
         $query->take(10);
     }])->find($id);
     //        dd($article);
     $views = Article::where('author_id', $article->author_id)->where('author_type', $article->author_type)->sum('views');
     $comments_count = Comment::where('article_id', $id)->count();
     $hots = Article::orderBy('views', 'desc')->take(10)->get();
     $is_like = false;
     $is_collection = false;
     $is_follow = false;
     if ($this->login_user) {
         $is_like = Like::where('user_id', $this->login_user->id)->where('like_type', 'article')->where('like_id', $id)->first();
         $is_collection = Collection::where('user_id', $this->login_user->id)->where('collection_type', 'article')->where('collection_id', $id)->first();
         $is_follow = DB::table('user_follow')->where('user_id', $this->login_user->id)->where('follow_id', $article->author_id)->first();
     }
     return view('front.article.index', compact('article', 'views', 'comments_count', 'hots', 'is_like', 'is_collection', 'is_follow'));
 }
开发者ID:nutsdo,项目名称:nong-store,代码行数:21,代码来源:ArticleController.php

示例8: findSpecialArticle

 public static function findSpecialArticle(SpecialArticle $specialArticle) : Article
 {
     return Cache::rememberForever("article.specialArticle.{$specialArticle}", function () use($specialArticle) {
         return Article::where('technical_name', $specialArticle)->firstOrFail();
     });
 }
开发者ID:spatie-custom,项目名称:blender,代码行数:6,代码来源:ArticleRepository.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $articles = Article::where('publish_time', '<=', Carbon::now())->orderBy('publish_time', 'desc')->paginate(15);
     return view('nweaver.commuity', compact('articles'));
 }
开发者ID:saviorZSC,项目名称:zsc_laravel,代码行数:11,代码来源:CommuityController.php

示例10: getDraft

 /**
  * Responds to requests to GET /article/draft/{id}
  *
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function getDraft($id)
 {
     $article = Article::where('user_id', '=', Auth::id())->where('state', '=', Article::DRAFT)->where(function ($q) use($id) {
         $q->where('slug', '=', $id)->orWhere('id', '=', $id);
     })->first();
     if (!$article) {
         return redirect()->action('ArticleController@getCreate');
     }
     $tags = implode(',', array_flatten($article->tags()->get(['name'])->toArray()));
     return view('articles.create', ['article' => $article, 'tags' => $tags]);
 }
开发者ID:psiskova,项目名称:blog-academy,代码行数:17,代码来源:ArticleController.php

示例11: news

 public function news()
 {
     $articles = Article::where('active', 1)->latest()->get();
     return view('home.news', ['articles' => $articles]);
 }
开发者ID:scotthummel,项目名称:scotthummel,代码行数:5,代码来源:HomeController.php

示例12: function

        // save方法
        $data = \App\Models\Articles::where('id', '=', 11)->first();
        $data->article_title = 'update test -3-.';
        $data->feature = true;
        $data->save();
    }]);
    Route::get('delete', ['as' => 'ORM.delete', function () {
        $data = \App\Models\Articles::find(2);
        $data->delete();
        \App\Models\Articles::destroy(19, 20);
    }]);
});
Route::get('test', function () {
    // $data = \App\Models\Article::find(5);
    $data1 = \App\Models\Article::all();
    $data2 = \App\Models\Article::where('id', '>', 8);
    $data3 = \App\Models\Article::orderBy('id', 'DESC');
    dd([$data1, $data2, $data3]);
});
/*
Route::get('hello', function(){
	return "Hello World!";
});

Route::get('post/{id}', function($id) {
	return "id:".$id;
})->where('id', '[0-9]+');

// route name
Route::get('post2/{id?}', ['as' => 'post2.show', function($id = 0) {
	return "id:".$id;
开发者ID:TenTail,项目名称:Laravel-Blog-Test,代码行数:31,代码来源:routes.php

示例13: updateBean

 public function updateBean(Request $request)
 {
     $customer = \Helper::getCustomer();
     if (!$customer) {
         return response()->json(['result' => '-1']);
     }
     /*if>*/
     if (!$customer->is_registered) {
         return response()->json(['result' => '-1']);
     }
     /*if>*/
     $article = Article::where('id', $request->input('id'))->first();
     \Analyzer::updateArticleStatistics($customer->id, $article->type_id);
     \Analyzer::updateBasicStatistics($customer->id, AnalyzerConstant::CUSTOMER_ARTICLE);
     \EnterpriseAnalyzer::updateArticleStatistics($article->type_id);
     \EnterpriseAnalyzer::updateBasic(AnalyzerConstant::ENTERPRISE_ARTICLE);
     if (\DailyAnalyzer::getDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE)) {
         \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE);
         return response()->json(['result' => '-1']);
     }
     \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE);
     \BeanRecharger::executeEducation($customer);
     return response()->json(['result' => '1']);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:24,代码来源:EducationController.php

示例14: getNewsBriefs

 public function getNewsBriefs()
 {
     return Article::where('page_id', 13)->where('published', 1)->orderBy('date_created', 'DESC')->get();
 }
开发者ID:scotthummel,项目名称:lambdaphx,代码行数:4,代码来源:LambdaRepository.php

示例15: delete

 public function delete($id)
 {
     Article::where('id', '=', $id)->update(array('status' => 0));
     return Redirect::back()->with('message', 'Article has been updated successfully!');
 }
开发者ID:Thor89,项目名称:horgaszkalandok,代码行数:5,代码来源:PostController.php


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