<?php

namespace App\Http\Controllers;

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
    {
        return view($this->view.'home');
    }

    /**
     * Send Notification.
     *
     * @return void
     */
    public function sendNotification()
    {
        // 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');
    }
}
