Selaa lähdekoodia

added fcm token field and accessor

Alexander Musikhin 1 viikko sitten
vanhempi
sitoutus
04f592441e

+ 1 - 0
app/Http/Controllers/UserController.php

@@ -26,6 +26,7 @@ class UserController extends Controller
             'name'          => 'ФИО',
             'phone'         => 'Телефон',
             'role'          => 'Роль',
+            'app_installed' => 'Приложение',
             'created_at'    => 'Дата создания',
             'deleted_at'    => 'Дата Удаления',
         ],

+ 5 - 0
app/Models/User.php

@@ -64,6 +64,11 @@ class User extends Authenticatable implements MustVerifyEmail
         return (string)$this->token_fcm;
     }
 
+    public function getAppInstalledAttribute(): string
+    {
+        return $this->token_fcm ? 'Да' : 'Нет';
+    }
+
     public function userNotifications(): HasMany
     {
         return $this->hasMany(UserNotification::class);

+ 4 - 0
resources/views/users/edit.blade.php

@@ -40,6 +40,10 @@
                         @include('partials.select', ['name' => 'role', 'title' => 'Роль', 'options' => getRoles(), 'value' => $user->role ?? \App\Models\Role::MANAGER])
 
                         @include('partials.input', ['name' => 'color', 'title' => 'Цвет', 'value' => $user->color ?? '#FFFFFF', 'type' => 'color'])
+
+                        @if($user)
+                            @include('partials.input', ['name' => 'token_fcm', 'title' => 'FCM Token', 'value' => $user->token_fcm ?? '', 'disabled' => true])
+                        @endif
                     </div>
 
                     <div class="tab-pane fade" id="notifications-pane" role="tabpanel" aria-labelledby="notifications-tab">