小编ash*_*ghe的帖子

如何居中对齐div标签中包含的标题和图像

我在div中有一个图像和标题标记,如何将它们与心爱的图像对齐.

<div class="clearfix">
    <img src="http://localhost/chifley-acf/wp-content/uploads/2017/03/icon-01.png" alt="Icon" class="pull-left">
    <h4>Refinancing</h4>
</div>
Run Code Online (Sandbox Code Playgroud)

像这样的电流输出

在此输入图像描述

但我想要这样

在此输入图像描述

html css twitter-bootstrap-3

5
推荐指数
0
解决办法
529
查看次数

Laravel-在不检查他人的情况下检查关系的最新记录的地方

我有两个表具有一对多关系。

预订- (id)

booking_tasks- (id, booking_id,user_id)

一项预订有很多任务一项任务有一个预订

预订模式:

 public function tasks() {
    return $this->hasMany('App\BookingTask');    
  }
Run Code Online (Sandbox Code Playgroud)

BookingTask模型

public function booking() {
    return $this->belongsTo('App\Booking');
} 
Run Code Online (Sandbox Code Playgroud)

我想获取预订列表,其中user_id = 2代表最新的booking_task。我不想检查其他旧的Booking_tasks。

例如:

在此处输入图片说明

我想检查booking_task的user_id = 2的最后一条记录,然后将其作为预订。在示例中,最后的booking_task的user_id =5。因此,它不会作为预订。

我的代码是:

$bookings=Booking::whereHas('tasks',function($q){
            $q->where('user_id',2);//this will check whether any of record has user_id =2
})->get();
Run Code Online (Sandbox Code Playgroud)

我也用过:但这不是正确的方法,

$bookings=Booking::whereHas('tasks',function($q){
                $q->latest()->where('user_id',2)->limit(1);//this will check whether any of record has user_id =2 and return latest one.
    })->get();
Run Code Online (Sandbox Code Playgroud)

我可以解决这个问题,我也必须使用Laravel Eloquent。

php sql-server eloquent laravel-5

2
推荐指数
1
解决办法
839
查看次数

标签 统计

css ×1

eloquent ×1

html ×1

laravel-5 ×1

php ×1

sql-server ×1

twitter-bootstrap-3 ×1