Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 16
HomeController
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 16
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 index
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 5
 sendNotification
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 10
<?php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\User;
use Notification;
use App\Notifications\ArticlesNotification;
use Config;
use Illuminate\View\View;
class HomeController extends Controller
{
    private $view = 'web.';
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        // $this->middleware('auth')->except('lang');
    }
    /**
     * Show the application dashboard.
     * @return View
     */
    public function index(): View
    {
        $settings= settings();
        $title= $settings['website_name'];
        $keywords= $settings['keywords'];
        $meta_description= $settings['meta_description'];
        return view($this->view.'home', compact('title', 'keywords', 'meta_description'));
    }
    /**
     * Send Notification.
     *
     * @return void
     */
    public function sendNotification() :void
    {
        // dd(Config::get('mail'));
        //get users from settings
        $user = User::first();
        $details = [
            'subject' => 'New Article',
            'greeting' => 'Hi Artisan',
            'body' => 'This is my first notification from ItSolutionStuff.com',
            'thanks' => 'Thank you for using ItSolutionStuff.com tuto!',
            'actionText' => 'View My Site',
            'actionURL' => url('/article/101'),
            'article_id' => 101
        ];
        // Notification::send($user, new ArticlesNotification($details));
        $user->notify(new ArticlesNotification($details));
        // dd('done');
    }
}