diff --git a/api/app/Http/Controllers/PushDeerMessageController.php b/api/app/Http/Controllers/PushDeerMessageController.php index 1ac72a1..15743a7 100644 --- a/api/app/Http/Controllers/PushDeerMessageController.php +++ b/api/app/Http/Controllers/PushDeerMessageController.php @@ -26,7 +26,7 @@ class PushDeerMessageController extends Controller $limit = 100; } - $pd_messages = Message::where('uid', $_SESSION['uid'])->orderBy('id', 'DESC')->offset(0)->limit($limit)->get(['id', 'uid', 'text', 'desp', 'type','created_at']); + $pd_messages = Message::where('uid', $_SESSION['uid'])->orderBy('id', 'DESC')->offset(0)->limit($limit)->get(['id', 'uid', 'text', 'desp', 'type','pushkey_name','created_at']); return http_result(['messages' => $pd_messages]); } @@ -63,6 +63,7 @@ class PushDeerMessageController extends Controller $the_message['desp'] = $validated['desp']; $the_message['type'] = $validated['type']; $the_message['readkey'] = $readkey; + $the_message['pushkey_name'] = $key->name; $pd_message = Message::create($the_message); $devices = PushDeerDevice::where('uid', $key->uid)->get(); diff --git a/api/app/Models/PushDeerMessage.php b/api/app/Models/PushDeerMessage.php index f823ec4..d4501f6 100644 --- a/api/app/Models/PushDeerMessage.php +++ b/api/app/Models/PushDeerMessage.php @@ -11,7 +11,7 @@ class PushDeerMessage extends Model protected $fillable = [ 'readkey', - 'pushkey', + 'pushkey_name', 'text', 'desp', 'uid', diff --git a/api/database/migrations/2022_01_09_095031_message_add_push_key.php b/api/database/migrations/2022_01_09_095031_message_add_push_key.php new file mode 100644 index 0000000..d7e3bc9 --- /dev/null +++ b/api/database/migrations/2022_01_09_095031_message_add_push_key.php @@ -0,0 +1,32 @@ +string('pushkey_name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('push_deer_messages', function (Blueprint $table) { + $table->dropColumn('pushkey_name'); + }); + } +}