function getExample1()
 {
     $book = new \p4\Book();
     $first = $book->first();
     echo $first;
     return 'getExample1';
 }
Ejemplo n.º 2
0
 /**
  * Responds to requests to POST /books/create
  */
 public function postCreate(Request $request)
 {
     $this->validate($request, ['title' => 'required|min:5', 'author' => 'required|min:5', 'cover' => 'required|url', 'published' => 'required|min:4']);
     // Code here to enter book into the database
     $book = new \p4\Book();
     $book->title = $request->title;
     $book->author = $request->author;
     //$book->author_id = 1;
     $book->cover = $request->cover;
     $book->published = $request->published;
     $book->purchase_link = $request->purchase_link;
     $book->save();
     // Confirm book was entered:
     //return 'Process adding new book: '.$request->input('title');
     //return view()
     \Session::flash('flash_message', 'Your book was added!');
     return redirect('/books');
 }