Exemplo n.º 1
0
 private function setUpObj()
 {
     $obj = new Image();
     $obj->title = 'title';
     $obj->slug = 'slug';
     $obj->filename = 'filename';
     $obj->description = 'description';
     $obj->save();
     return $obj;
 }
Exemplo n.º 2
0
 /**
  * Tes menambahkan Image
  */
 public function testAdd()
 {
     $obj = new Image();
     $obj->title = 'title';
     $obj->slug = 'slug';
     $obj->filename = 'filename';
     $obj->description = 'description';
     $saved = $obj->save();
     $this->assertTrue($saved);
     $obj_2 = Image::find($obj->id);
     if ($obj_2 !== null) {
         $this->assertEquals($obj, $obj_2);
     }
 }
Exemplo n.º 3
0
 /**
  * Get posts of the image.
  *
  * @return Response
  */
 public function getPosts($id)
 {
     $image = Image::find($id);
     if ($image) {
         $posts = $image->posts()->get();
         return $posts;
     }
     throw new CrudException('image:getPosts');
 }