当前位置: 首页>>代码示例>>PHP>>正文


PHP Books::all方法代码示例

本文整理汇总了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
 }
开发者ID:JoseJesusOchoaTorres,项目名称:dracarys,代码行数:14,代码来源:BooksController.php

示例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;
}
开发者ID:Devenet,项目名称:MyBooks,代码行数:34,代码来源:index.php

示例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'));
 }
开发者ID:zurez,项目名称:rentkardo,代码行数:10,代码来源:IndexController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $books = Books::all();
     return Response::array($books);
 }
开发者ID:a1ex7,项目名称:gitlesson,代码行数:10,代码来源:BookController.php

示例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);
开发者ID:limweb,项目名称:webappservice,代码行数:31,代码来源:test.php

示例6: archive

 /**
  * Render the books archive page.
  */
 public function archive()
 {
     return View::make('pages.books', array('books' => $this->books->all()));
 }
开发者ID:johnulist,项目名称:bookstore,代码行数:7,代码来源:BooksController.php

示例7: index

 public function index()
 {
     $book = Books::all();
     return View::make('books.index')->with('books', $book);
 }
开发者ID:pnagaraju25,项目名称:larvelCrudFinal,代码行数:5,代码来源:BookController.php


注:本文中的Books::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。