refactor: prefer ::query() over laravel eloquent magic

Significantly improves DX with LSP compatibility. Now it's possible to navigate to the definition of these functions in laravel and get ide autocomplete.
This commit is contained in:
Roardom
2025-12-15 10:46:24 +00:00
parent a00c58200d
commit d128cd5236
229 changed files with 744 additions and 681 deletions
+2 -2
View File
@@ -43,11 +43,11 @@ class ProcessMassPM implements ShouldQueue
*/
public function handle(): void
{
$conversation = Conversation::create(['subject' => $this->subject]);
$conversation = Conversation::query()->create(['subject' => $this->subject]);
$conversation->users()->sync([$this->senderId => ['read' => true], $this->receiverId]);
PrivateMessage::create([
PrivateMessage::query()->create([
'conversation_id' => $conversation->id,
'sender_id' => $this->senderId,
'message' => $this->message