コード例 #1
0
 /**
  * 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
0
ファイル: index.php プロジェクト: Devenet/MyBooks
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
0
ファイル: IndexController.php プロジェクト: zurez/rentkardo
 /**
  * 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
0
ファイル: BookController.php プロジェクト: a1ex7/gitlesson
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $books = Books::all();
     return Response::array($books);
 }
コード例 #5
0
ファイル: test.php プロジェクト: limweb/webappservice
<?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
0
 /**
  * Render the books archive page.
  */
 public function archive()
 {
     return View::make('pages.books', array('books' => $this->books->all()));
 }
コード例 #7
0
 public function index()
 {
     $book = Books::all();
     return View::make('books.index')->with('books', $book);
 }