Example #1
0
 /**
  * Subscribe achievements
  */
 public function handle()
 {
     Achieve::created(function (Achieve $achieve) {
         $room = \App::make(Room::class);
         $room->write(\Lang::get('achieve.receiving', ['user' => $achieve->user->login, 'title' => $achieve->title, 'description' => $achieve->description, 'image' => $achieve->image]));
     });
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     foreach (\App\Achieve::all() as $a) {
         if (strstr($a->name, 'KarmaAchieve')) {
             $a->name = KarmaAchieve::class;
         } else {
             if (strstr($a->name, 'Karma50Achieve')) {
                 $a->name = Karma50Achieve::class;
             } else {
                 if (strstr($a->name, 'Karma100Achieve')) {
                     $a->name = Karma100Achieve::class;
                 } else {
                     if (strstr($a->name, 'Karma500Achieve')) {
                         $a->name = Karma500Achieve::class;
                     }
                 }
             }
         }
         $a->save();
     }
     // $this->call(UserTableSeeder::class);
     Model::reguard();
 }
Example #3
0
 /**
  * @param User $user
  * @param Carbon|null $createdAt
  * @return Achieve
  * @throws \LogicException
  */
 public function create(User $user, Carbon $createdAt = null) : Achieve
 {
     $achieve = Achieve::create(['name' => $this->name, 'user_id' => $user->id, 'created_at' => $createdAt ?: Carbon::now()]);
     return $achieve;
 }