public function postRing($uuid, Request $req)
 {
     try {
         $bell = Bell::where('uuid', $uuid)->first();
         $user = $bell->user;
         $file = '';
         if ($req->hasFile('image')) {
             $image = $req->file('image');
             if ($image->isValid()) {
                 $file = Uuid::generate(1)->string;
                 $image->move(public_path() . '/img/uploads/', $file);
             }
         }
         $ring = Ring::create(['user_id' => $user->id, 'bell_id' => $bell->id, 'file' => $file]);
         $ring->save();
         $clients = $user->push_clients;
         if (!$clients->isEmpty() && $bell->active == 1) {
             $token = [];
             foreach ($clients as $client) {
                 $token[] = $client->token;
             }
             $http = new \GuzzleHttp\Client();
             $res = $http->request('POST', 'https://android.googleapis.com/gcm/send', ['headers' => ['Authorization' => 'key=' . env('SMARTBELL_GCM')], 'json' => ["registration_ids" => $token, "data" => ["image" => $file, "name" => $bell->name]]]);
         }
         return ['success'];
     } catch (\Exception $e) {
         return ['failure'];
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = \SmartBell\User::create(['email' => '*****@*****.**', 'password' => bcrypt('123')]);
     $bell = \SmartBell\Bell::create(['name' => "Test Klingel", 'user_id' => $user->id, 'active' => 1, 'uuid' => Uuid::generate(1)->string]);
     $bell->name = "Test Klingel";
     $bell->user_id = $user->id;
     $bell->active = true;
     $bell->save();
     for ($i = 0; $i < 10; $i++) {
         \SmartBell\Ring::create(['user_id' => $user->id, 'bell_id' => $bell->id, 'file' => '']);
     }
 }
 public function post(Request $req)
 {
     $bell = Bell::create(['user_id' => $this->currentUser->id, 'name' => $req->get('name'), 'active' => '1', 'uuid' => Uuid::generate(1)->string]);
     return $bell;
 }