public function run()
 {
     DB::table('books')->delete();
     Books::create(array('bname' => 'talha', 'bauthor' => 'talha1', 'bedition' => 'Eight', 'p_url' => 'ajed5hrgt4y', 'created_at' => new DateTime(), 'updated_at' => new DateTime()));
     DB::table('books')->insert(['bname' => 'talha', 'bauthor' => 'talha2', 'bedition' => 'ten', 'p_url' => 'ajed53y56hy', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     DB::table('books')->insert(['bname' => 'talha', 'bauthor' => 'talha3', 'bedition' => 'nine', 'p_url' => 'ajed5hy', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
 }
 public function doAddBook()
 {
     // validate the info, create rules for the inputs
     $rules = array('title' => 'required|unique:books,title', 'author' => 'required');
     // run the validation rules on the inputs from the form
     $validator = Validator::make(Input::all(), $rules);
     // if the validator fails, redirect back to the form
     if ($validator->fails()) {
         return Redirect::to('add')->withErrors($validator)->withInput();
         // send back the input (not the password) so that we can repopulate the form
     } else {
         //return 'book added';
         // create our user data for the authentication
         $bookdata = array('title' => Input::get('title'), 'author' => Input::get('author'), 'user_email' => Input::get('user_email'));
         // attempt to do the login
         if ($user = Books::create($bookdata)) {
             // validation successful!
             return Redirect::to('books')->with('message', 'Book added successfully');
         } else {
             // book creation, send back to form
             return Redirect::to('add')->with('message', 'Book creation failed');
         }
     }
 }