本文整理匯總了PHP中app\Branch::whereIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Branch::whereIn方法的具體用法?PHP Branch::whereIn怎麽用?PHP Branch::whereIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Branch
的用法示例。
在下文中一共展示了Branch::whereIn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exportPdf
public function exportPdf($ids = null)
{
$ids = explode(',', substr($ids, 0, -1));
$ids = array_unique($ids);
$model = Branch::whereIn('id', $ids)->where('user_id', \Auth::user()->id)->get(['id', 'nom_branche', 'code_branche']);
Excel::create('La liste des Branches', function ($excel) use($model, $ids) {
$excel->sheet('La liste des Branches', function ($sheet) use($model, $ids) {
foreach ($model as $branch) {
$branch->nbr = $branch->children()->count();
unset($branch->id);
}
$sheet->fromModel($model);
$sheet->setAllBorders('thin');
$sheet->setFontFamily('OpenSans');
$sheet->setFontSize(13);
$sheet->setFontBold(false);
$sheet->setAllBorders('thin');
for ($i = 1; $i <= count($ids) + 1; $i++) {
$sheet->setHeight($i, 25);
$sheet->row($i, function ($rows) {
$rows->setFontColor('#556b7b');
$rows->setAlignment('center');
});
$sheet->cells('A' . $i . ':' . 'C' . $i, function ($cells) {
$cells->setValignment('middle');
$cells->setFontColor('#556b7b');
$cells->setFont(array('family' => 'OpenSans', 'size' => '13', 'bold' => false));
});
}
// normal header
$sheet->cells('A1:C1', function ($cells) {
$cells->setBackground('#e9f1f3');
$cells->setFontColor('#556b7b');
$cells->setFont(array('family' => 'OpenSans', 'size' => '15', 'bold' => true));
});
$sheet->row(1, array('Nom de la Branche', 'Code de La Branche', "Nombre d'élèves"));
});
})->export('pdf');
}