Passed
Push — dev6 ( 5ebf7f...1a3248 )
by Ron
16:55
created

SendTestEmailController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
c 1
b 0
f 0
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 2
1
<?php
2
3
namespace App\Http\Controllers\Admin\Email;
4
5
use App\Http\Controllers\Controller;
6
use App\Notifications\SendTestEmail;
7
use Exception;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Facades\Auth;
10
use Illuminate\Support\Facades\Notification;
11
12
class SendTestEmailController extends Controller
13
{
14
    /**
15
     * Send a test email
16
     */
17
    public function __invoke(Request $request)
18
    {
19
        try
20
        {
21
            Notification::send(Auth::user(), new SendTestEmail);
22
23
            return [
24
                'success' => true,
25
            ];
26
        }
27
        catch(Exception $e)
28
        {
29
            return [
30
                'success' => false,
31
                'message' => $e->getMessage(),
32
            ];
33
        }
34
    }
35
}
36