391 Notification refactorings (#441)

* Refactor notifications to allow easier plugins

* Notification refactoring

* Formatting

* Move news to NewsService; cleanup of events

* More refactoring; added send email out for news item and the template

* Formatting

* Formatting
This commit is contained in:
Nabeel S
2019-11-20 10:16:01 -05:00
committed by GitHub
parent 02973a0f22
commit ea3ab21beb
66 changed files with 754 additions and 718 deletions

View File

@@ -4,9 +4,9 @@ namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Repositories\KvpRepository;
use App\Repositories\NewsRepository;
use App\Repositories\PirepRepository;
use App\Repositories\UserRepository;
use App\Services\NewsService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
@@ -15,7 +15,7 @@ use Laracasts\Flash\Flash;
class DashboardController extends Controller
{
private $kvpRepo;
private $newsRepo;
private $newsSvc;
private $pirepRepo;
private $userRepo;
@@ -23,20 +23,20 @@ class DashboardController extends Controller
* DashboardController constructor.
*
* @param KvpRepository $kvpRepo
* @param NewsRepository $newsRepo
* @param PirepRepository $pirepRepo
* @param UserRepository $userRepo
* @param $newsSvc
*/
public function __construct(
KvpRepository $kvpRepo,
NewsRepository $newsRepo,
NewsService $newsSvc,
PirepRepository $pirepRepo,
UserRepository $userRepo
) {
$this->kvpRepo = $kvpRepo;
$this->newsRepo = $newsRepo;
$this->pirepRepo = $pirepRepo;
$this->userRepo = $userRepo;
$this->newsSvc = $newsSvc;
}
/**
@@ -93,10 +93,10 @@ class DashboardController extends Controller
$attrs = $request->post();
$attrs['user_id'] = Auth::user()->id;
$this->newsRepo->create($attrs);
$this->newsSvc->addNews($attrs);
} elseif ($request->isMethod('delete')) {
$news_id = $request->input('news_id');
$this->newsRepo->delete($news_id);
$id = $request->input('news_id');
$this->newsSvc->deleteNews($id);
}
return view('admin.dashboard.news', [