本文整理汇总了PHP中app\Book::get_all_books方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::get_all_books方法的具体用法?PHP Book::get_all_books怎么用?PHP Book::get_all_books使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Book
的用法示例。
在下文中一共展示了Book::get_all_books方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: booksreturn
/**
* Show the form for returning books.
*
* @return Response
*/
public function booksreturn($personid, $datetime = '', $custom_date = '')
{
// ВЫНЕСТИ ИЗ КОНТРОЛЛЕРА
$editing = [];
// Если массив не пустой - редактируем.
// В любом случае при сохранении можно удялять все.
// Если создаем - ничего не треяем. Если редактируем - так и надо.
if ($datetime) {
// выбираем редактируемые операции
$os = DB::table('operations')->where('person_id', $personid)->where('datetime', $datetime)->get();
foreach ($os as $o) {
$bookvalues[$o->book_id] = $o->quantity;
if ($o->description) {
$editing['description'] = $o->description;
}
$custom_date = $o->custom_date;
}
$editing['bookvalues'] = $bookvalues;
$books = Book::get_all_books(Auth::user()->id);
} else {
list($oss, $bks) = Operation::get_operations($personid);
$bkss = Book::get_all_books(Auth::user()->id);
$books = [];
foreach ($bkss as $k => $b) {
if (isset($bks[$k])) {
$books[$k] = $b;
$b->havegot = $bks[$k][0];
}
}
}
return view('operation.return', ['books' => $books, 'operation_type' => 4, 'personid' => $personid, 'editing' => $editing, 'datetime' => $datetime, 'custom_date' => $custom_date]);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$books = Book::get_all_books(Auth::user()->id);
return view('books.index', ['books' => $books]);
}