我有一个合作伙伴 - 客户表。无论是合作伙伴(类型'1')还是客户(类型'2'),插入的每条记录都有徽标图像和一个复选框,用于决定徽标是否会显示在主页中。
主页有2个不同的轮播幻灯片,可根据类型显示合作伙伴和客户。
我如何:
答案 0 :(得分:1)
我会采用这种方法:
//My Controller File
public function index()
{
// type = 1: partners
$partners = PartnersCustomer::whereType(1)->get();
// type =2 : customers
$customers = PartnersCustomer::whereType(2)->get();
return view('my-blade-file-path')->with('partners', $partner)->with('customers' , $customers);
}
在您的刀片模板中
<!-- INSIDE YOUR BLADE TEMPLATE -->
@foreach($customers as $customer)
@if($customer->display_logo == 1)
<img src="{{ $customer->logo_path}}" />
@endif
@endforeach
答案 1 :(得分:0)
方法应该是这样的: 控制器功能
const FinancialEvent = __webpack_require__(59);
// Other requires removed for clarity.
const {
financial: {
environments
}
} = __webpack_require__(14);
class DummyParent extends Object {
}
class DwollaEvent extends DummyParent {
查看文件
public function getImage()
{
$data = (new PartnersCustomer)->get();
$customer = data['image'];
if ($data['type'] == 1) {
$partner = data['image'];
}
return view('index.blade.php')->compact('customer', 'partner');
}