本文整理汇总了PHP中Blog::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::orderBy方法的具体用法?PHP Blog::orderBy怎么用?PHP Blog::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::orderBy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$victories = Victory::orderBy('created_at', 'DESC')->limit(4)->get();
$blogs = Blog::orderBy('created_at', 'DESC')->limit(4)->get();
$images = Post::where('is_carasaul', '=', 1)->get();
$testimonials = Testimonial::orderBy('created_at', 'DESC')->limit(1)->get();
return View::make('pages.index', compact('images', 'testimonials', 'victories', 'blogs'));
}
示例2: index
public function index()
{
$user_id = Input::get('user_id');
if (FEUsersHelper::isCurrentUser($user_id)) {
$blogs = Blog::orderBy('updated_at', 'DESC')->where('user_id', $user_id)->get();
} else {
$blogs = Blog::orderBy('updated_at', 'DESC')->where('user_id', $user_id)->where('privacy', 1)->get();
}
return View::make('frontend/blogs/index')->with('user', User::find($user_id))->with('blogs', $blogs);
}
示例3: index_users
public function index_users()
{
$tags = Tag::all();
$blogs = Blog::orderBy('created_at', 'desc')->where('is_published', '=', 1)->paginate(10);
return View::make('blogs.index_user', compact('blogs', 'tags'));
}
示例4: mostrarBlog
public function mostrarBlog()
{
//$Posts = DB::table('blog')->orderBy('id','desc')->paginate(2);
//$bannersizquierda = DB::table('banners')->where('seccion', '=', 'BLOG-IZQUIERDA','AND')->where('habilitar', '=', '1')->orderBy('id','asc')->get();
$bannersizquierda = Banner::where('seccion', '=', 'BLOG-IZQUIERDA')->where('habilitar', '=', '1')->orderBy('id', 'asc')->get();
$bannersderecha = Banner::where('seccion', '=', 'BLOG-DERECHA')->where('habilitar', '=', '1')->orderBy('id', 'asc')->get();
$bannersindexarriba = Banner::where('seccion', '=', 'INDEX-ARRIBA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get();
$blog = Blog::orderBy('fecha', 'desc')->paginate(5);
$anuncios = Anuncio::all();
$rolusuarioLogueado = '';
$mailusuarioLogueado = '';
$nombreusuarioLogueado = '';
if (Auth::check()) {
$authuser = Auth::user();
$usu = Usuario::find($authuser->id);
$mailusuarioLogueado = $authuser->email;
$nombreusuarioLogueado = $authuser->nombre;
$rolusuarioLogueado = DB::table('usuario_tiene_rol2')->where('usuario_id', '=', $authuser->id)->first();
$rolusuarioLogueado = UsuarioRol::find($rolusuarioLogueado->rol_id)->rol;
}
return View::make('index.blog')->with(array('bannersizquierda' => $bannersizquierda, 'bannersderecha' => $bannersderecha, 'blog' => $blog, 'anuncios' => $anuncios, 'username' => $mailusuarioLogueado, 'nameuser' => $nombreusuarioLogueado, 'roluser' => $rolusuarioLogueado, 'bannersindexarriba' => $bannersindexarriba));
//
}
示例5: articles
public function articles()
{
$articles = Blog::orderBy('id', 'DESC')->paginate(4);
return View::make('blog.articles', compact('articles'));
}