/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     \Api\Post::truncate();
     factory(\Api\Post::class, 15)->create();
     Model::reguard();
 }
Exemplo n.º 2
0
 /**
  * Retrieves images from a redditbooru album
  */
 public static function getRedditBooruImages($url)
 {
     $retVal = null;
     // For testing purposes, we'll use a call to the API. In final version, this will be a database call
     $id = Api\Post::getPostIdFromUrl($url);
     if ($id) {
         $sub = strpos($url, 'beta.') !== false ? 'beta.' : '';
         $data = Http::get('http://' . $sub . 'redditbooru.com/images/?postId=' . $id);
         if ($data) {
             $data = json_decode($data);
             if (count($data) > 0) {
                 $retVal = [];
                 foreach ($data as $image) {
                     $retVal[] = $image->cdnUrl;
                 }
             }
         }
     }
     return $retVal;
 }