Ejemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $genres = $this->genreService->getAllGenres();
     foreach ($genres as $genre) {
         Genre::updateOrCreate(['name' => $genre['name']], ['name' => $genre['name'], 'approved' => true]);
     }
 }
Ejemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     Genre::query()->update(['approved' => false]);
     $genres = explode("\n", file_get_contents("php://stdin"));
     foreach ($genres as $genre) {
         $query = Genre::where('name', $genre);
         if ($query->exists()) {
             $query->update(['approved' => true]);
         } else {
             Genre::create(['name' => $genre, 'approved' => true]);
         }
     }
 }
Ejemplo n.º 3
0
 protected function getRandomGenres()
 {
     return Genre::where('approved', true)->orderBy(DB::raw('random()'))->limit(config('rock_expert.tasks.count'))->get()->toArray();
 }
Ejemplo n.º 4
0
 protected function getMainGenre($genres)
 {
     return array_first($genres, function ($i, $genre) {
         return Genre::where('name', $genre)->exists();
     });
 }
Ejemplo n.º 5
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     app(EchoNestService::class)->updateArtists(Genre::all());
 }