Files
roxane/app/Services/ContactService.php

25 lines
544 B
PHP
Raw Permalink Normal View History

2025-10-24 14:38:11 +02:00
<?php
namespace App\Services;
use App\Models\Contact;
2026-04-07 17:09:25 +02:00
use App\Notifications\ContactNewRequestNotification;
use Illuminate\Support\Facades\Notification;
2025-10-24 14:38:11 +02:00
class ContactService
{
2026-04-07 17:09:25 +02:00
public function __construct() {}
2025-10-24 14:38:11 +02:00
public function registerNewContactRequest(array $data): Contact
{
2026-04-07 17:09:25 +02:00
$contact = new Contact;
2025-10-24 14:38:11 +02:00
$contact->fill($data);
$contact->save();
2026-04-07 17:09:25 +02:00
Notification::route('mail', config('app.admin_email'))
->notify(new ContactNewRequestNotification($contact));
2025-10-26 00:16:25 +02:00
return $contact;
2025-10-24 14:38:11 +02:00
}
}