本文整理汇总了PHP中Books::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Books::all方法的具体用法?PHP Books::all怎么用?PHP Books::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Books
的用法示例。
在下文中一共展示了Books::all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// get all the books
$books = Books::all();
//donde Books es el nombre de nuestro modelo
// load the view and pass the users
return View::make('books.index', array('books' => $books));
// donde 'books.index' es carpeta y archivo
}
示例2: exportPage
function exportPage()
{
if (!isLogged()) {
header('Location: ' . Path::signin() . '&target=export');
exit;
}
global $tpl;
global $_CONFIG;
$books = new Books();
if (!empty($_POST)) {
if (!empty($_POST['token']) && acceptToken($_POST['token'])) {
$private = !isset($_POST['private']);
$images = isset($_POST['images']);
$export = array();
if (!empty($_POST['book'])) {
foreach ($_POST['book'] as $key => $value) {
$export[] = $key;
}
}
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="' . trim(mb_convert_case(TITLE, MB_CASE_LOWER, "UTF-8")) . '_' . date('Y_m_d') . '.json"');
header('Content-type: application/json');
exit($books->export($private, $images, $export));
}
errorPage('The received token was empty or invalid.', 'Invalid security token');
}
$tpl->assign('page_title', 'Export books');
$tpl->assign('menu_links', Path::menu('export'));
$tpl->assign('menu_links_admin', Path::menuAdmin('admin'));
$tpl->assign('books', $books->all());
$tpl->assign('token', getToken());
$tpl->draw('admin.export');
exit;
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$books = Books::all();
return View::make('index')->with(array('books' => $books, 'title' => 'Home'));
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$books = Books::all();
return Response::array($books);
}
示例5:
<?php
include 'database.php';
class Books extends Illuminate\Database\Eloquent\Model
{
public $timestamps = true;
}
// Create the Books model
// Grab a book with an id of 1
// $book = Books::find(1);
// var_dump($book);
// Change some stuff
// $book->name = "The Best Book in the World";
// $book->author = "Ed Zynda";
// Save it to the database
// $book->save();
// $books = Books::all();
$books = Books::find(1);
$books->touch();
$books = Books::find(2);
$books->touch();
$books = Books::find(3);
$books->touch();
// foreach ($books as $book)
// {
// echo $book->author;
// }
$books = Books::all();
$bar = $books->toJson();
var_dump($bar);
var_dump($capsule);
示例6: archive
/**
* Render the books archive page.
*/
public function archive()
{
return View::make('pages.books', array('books' => $this->books->all()));
}
示例7: index
public function index()
{
$book = Books::all();
return View::make('books.index')->with('books', $book);
}