Ejemplo n.º 1
0
 /**
  * Add new Video
  *
  * @return bool
  */
 public function add($title, $desc, $image, $updatedby, $position, $ttl)
 {
     $validator = Validator::make(array('type' => $title, 'desc' => $desc, 'image' => $image, 'updatedby' => $updatedby, 'position' => $position, 'title' => $ttl), array('type' => array('required'), 'desc' => array(), 'image' => array(), 'updatedby' => array('required'), 'position' => array('required'), 'title' => array()));
     // Validation did not pass
     if ($validator->fails()) {
         throw new Exception($validator->messages());
     }
     try {
         //dd($title);
         $HomeSlides = new HomeContents();
         $HomeSlides->type = $title;
         $HomeSlides->title = $ttl;
         $HomeSlides->desc = $desc;
         $HomeSlides->image = $image;
         $HomeSlides->position = $position;
         $HomeSlides->updatedby = $updatedby;
         $HomeSlides->active = 1;
         $HomeSlides->save();
         return $HomeSlides;
     } catch (Exception $ex) {
         return $ex;
     }
 }