public function buyerAlreadybrand(){
        $effect = Request::get('effect');
        $data = $this->brand->where(function($query) use($effect){
            if($effect == -){
               return $query->where('effectivetime','<',date('Y-m-d'));
            }else{
               return $query->where('pur_date','<=',date('Y-m-d'));
            }
        })->orderby('pur_date','desc')->get();
        return View::make('member::publish.buyer_alreadybrand', compact('data'))->withEffect($effect);
    }
<li class="@if(!$effect) active @endif"><a href="?">已发布</a></li>
<li class="@if($effect == -1 ) active @endif"><a href="?effect=-1">已过期</a></li>

laravel数据库查询是use方法的使用的更多相关文章

  1. laravel数据库查询返回的数据形式

    版本:laravel5.4+ 问题描述:laravel数据库查询返回的数据不是单纯的数组形式,而是数组与类似stdClass Object这种对象的结合体,即使在查询构造器中调用了toArray(), ...

  2. laravel 数据库查询的一些函数意义(未完)

    ->all() 查询数据库中的全部信息,一对象形式返回 $rows=UserModel::all(); ->get() 查询的执行函数,->toArray()将查询的是数据集转换成数 ...

  3. yii2.0数据库查询修改等方法

    yii2.0学习有一段时间了,给大家分享一下一些简单的查询等如何操作. 查询:(这里最前面的Test是引用的模型名) Test::find()->all();    此方法返回所有数据: Tes ...

  4. [moka学习笔记]yii2.0数据库查询的多种方法(未完待整理)

    方法一:(使用model) $modelCommunityMail = CommunityMail::find()->where(['com_id'=>$id])->all(); 方 ...

  5. python3 数据库查询

    #xiaodeng #python 3 #数据库查询 #第一种方法(fethall,返回所有行数据) import pymysql #connect链接服务器,注意和服务库编码一致 conn=pymy ...

  6. C#连接Oracle数据库查询数据

    C#连接Oracle数据库可以实现许多我们需要的功能,下面介绍的是C#连接Oracle数据库查询数据的方法,如果您对C#连接Oracle数据库方面感兴趣的话,不妨一看. using System; u ...

  7. 优化SQL Server数据库查询方法

    SQL Server数据库查询速度慢的原因有很多,常见的有以下几种: 1.没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷) 2.I/O吞吐量小,形成了瓶颈效应. 3.没有创建计算列 ...

  8. 转载 50种方法优化SQL Server数据库查询

    原文地址 http://www.cnblogs.com/zhycyq/articles/2636748.html 50种方法优化SQL Server数据库查询 查询速度慢的原因很多,常见如下几种: 1 ...

  9. ORACLE跨数据库查询的方法

    原文地址:http://blog.csdn.net/huzhenwei/article/details/2533869 本文简述了通过创建database link实现Oracle跨数据库查询的方法 ...

随机推荐

  1. C++中argc和argv

    C++中argc和argv C/C++中关于main()函数中argc 和argv[]的说明 main(int argc,char *argv[]); argc代表命令行输入参数的个数 argv存储了 ...

  2. hdu 1201 18岁生日

    #include <stdio.h> int r(int y) { return (y%4==0&&y%100!=0)||(y%400==0); } int f(int y ...

  3. KxMenu下拉菜单

    + (void)createMenu:(id)sender target:(UIViewController *)t { NSArray *menuItems = @[ [KxMenuItem men ...

  4. destroy-method="close"的作用

    destroy-method="close"的作用是当数据库连接不使用的时候,就把该连接重新放到数据池中,方便下次使用调用.

  5. js中的getAttribute方法使用示例

    getAttribute()方法是一个函数.它只有一个参数——你打算查询的属性的名字,下面为大家介绍下其具体的使用   getAttribute()方法 至此,我们已经向大家介绍了两种检索特定元素节点 ...

  6. centos安装配置nginx

    1.安装gcc yum install gcc 2.安装PCRE,zlib,OpenSSL(其中devel,是develop开发包的意思) yum install -y pcre pcre-devel ...

  7. MotionEvent常见值

    常见的动作常量: public static final int ACTION_DOWN        = 0;单点触摸动作 public static final int ACTION_UP     ...

  8. iOS 利用self.navigationItem.backBarButtonItem修改后退按钮文字

    @property(nonatomic,retain) UIBarButtonItem *backBarButtonItem; // Bar button item to use for the ba ...

  9. 转centos65安装简测mysql cluster 7.3.7

    MySQLCluster是sharednothing分布式架构,ndb存储引擎把数据放置于内存中.可以做到无单点故障.由运行于不同服务器上的的多种进程构成,组件包括SQL节点,NDBD数据节点,管理程 ...

  10. VMware安装64位操作系统提示Intel VT-x处于禁用状态的解决办法

    用VMware安装64位操作系统时,如果目前本地的操作系统是64位的,那么可以说明CPU是肯定支持64位的,这时候如果提示此主机支持 Intel VT-x,但 Intel VT-x 处于禁用状态.这个 ...