Use the new dispatch helper function
This commit is contained in:
@@ -22,15 +22,12 @@ use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class ComponentController extends Controller
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Array of sub-menu items.
|
||||
*
|
||||
@@ -130,7 +127,7 @@ class ComponentController extends Controller
|
||||
$tags = array_pull($componentData, 'tags');
|
||||
|
||||
try {
|
||||
$component = $this->dispatch(new UpdateComponentCommand(
|
||||
$component = dispatch(new UpdateComponentCommand(
|
||||
$component,
|
||||
$componentData['name'],
|
||||
$componentData['description'],
|
||||
@@ -184,7 +181,7 @@ class ComponentController extends Controller
|
||||
$tags = array_pull($componentData, 'tags');
|
||||
|
||||
try {
|
||||
$component = $this->dispatch(new AddComponentCommand(
|
||||
$component = dispatch(new AddComponentCommand(
|
||||
$componentData['name'],
|
||||
$componentData['description'],
|
||||
$componentData['status'],
|
||||
@@ -223,7 +220,7 @@ class ComponentController extends Controller
|
||||
*/
|
||||
public function deleteComponentAction(Component $component)
|
||||
{
|
||||
$this->dispatch(new RemoveComponentCommand($component));
|
||||
dispatch(new RemoveComponentCommand($component));
|
||||
|
||||
return Redirect::route('dashboard.components.index')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.delete.success')));
|
||||
@@ -238,7 +235,7 @@ class ComponentController extends Controller
|
||||
*/
|
||||
public function deleteComponentGroupAction(ComponentGroup $group)
|
||||
{
|
||||
$this->dispatch(new RemoveComponentGroupCommand($group));
|
||||
dispatch(new RemoveComponentGroupCommand($group));
|
||||
|
||||
return Redirect::route('dashboard.components.index')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.delete.success')));
|
||||
@@ -277,7 +274,7 @@ class ComponentController extends Controller
|
||||
public function postAddComponentGroup()
|
||||
{
|
||||
try {
|
||||
$group = $this->dispatch(new AddComponentGroupCommand(
|
||||
$group = dispatch(new AddComponentGroupCommand(
|
||||
Binput::get('name'),
|
||||
Binput::get('order', 0)
|
||||
));
|
||||
@@ -302,7 +299,7 @@ class ComponentController extends Controller
|
||||
public function updateComponentGroupAction(ComponentGroup $group)
|
||||
{
|
||||
try {
|
||||
$group = $this->dispatch(new UpdateComponentGroupCommand(
|
||||
$group = dispatch(new UpdateComponentGroupCommand(
|
||||
$group,
|
||||
Binput::get('name'),
|
||||
Binput::get('order', 0)
|
||||
|
||||
@@ -20,15 +20,12 @@ use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class IncidentController extends Controller
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Stores the sub-sidebar tree list.
|
||||
*
|
||||
@@ -110,7 +107,7 @@ class IncidentController extends Controller
|
||||
public function createIncidentAction()
|
||||
{
|
||||
try {
|
||||
$incident = $this->dispatch(new ReportIncidentCommand(
|
||||
$incident = dispatch(new ReportIncidentCommand(
|
||||
Binput::get('name'),
|
||||
Binput::get('status'),
|
||||
Binput::get('message'),
|
||||
@@ -202,7 +199,7 @@ class IncidentController extends Controller
|
||||
*/
|
||||
public function deleteIncidentAction(Incident $incident)
|
||||
{
|
||||
$this->dispatch(new RemoveIncidentCommand($incident));
|
||||
dispatch(new RemoveIncidentCommand($incident));
|
||||
|
||||
return Redirect::route('dashboard.incidents.index')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
|
||||
@@ -234,7 +231,7 @@ class IncidentController extends Controller
|
||||
public function editIncidentAction(Incident $incident)
|
||||
{
|
||||
try {
|
||||
$incident = $this->dispatch(new UpdateIncidentCommand(
|
||||
$incident = dispatch(new UpdateIncidentCommand(
|
||||
$incident,
|
||||
Binput::get('name'),
|
||||
Binput::get('status'),
|
||||
|
||||
@@ -18,15 +18,12 @@ use CachetHQ\Cachet\Commands\Metric\UpdateMetricCommand;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class MetricController extends Controller
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Shows the metrics view.
|
||||
*
|
||||
@@ -74,7 +71,7 @@ class MetricController extends Controller
|
||||
$metricData = Binput::get('metric');
|
||||
|
||||
try {
|
||||
$this->dispatch(new AddMetricCommand(
|
||||
dispatch(new AddMetricCommand(
|
||||
$metricData['name'],
|
||||
$metricData['suffix'],
|
||||
$metricData['description'],
|
||||
@@ -114,7 +111,7 @@ class MetricController extends Controller
|
||||
*/
|
||||
public function deleteMetricAction(Metric $metric)
|
||||
{
|
||||
$this->dispatch(new RemoveMetricCommand($metric));
|
||||
dispatch(new RemoveMetricCommand($metric));
|
||||
|
||||
return Redirect::route('dashboard.metrics.index')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.delete.success')));
|
||||
@@ -144,7 +141,7 @@ class MetricController extends Controller
|
||||
public function editMetricAction(Metric $metric)
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new UpdateMetricCommand(
|
||||
dispatch(new UpdateMetricCommand(
|
||||
$metric,
|
||||
Binput::get('metric.name', null, false),
|
||||
Binput::get('metric.suffix', null, false),
|
||||
|
||||
@@ -17,7 +17,6 @@ use CachetHQ\Cachet\Dates\DateFactory;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
@@ -26,8 +25,6 @@ use Jenssegers\Date\Date;
|
||||
|
||||
class ScheduleController extends Controller
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Stores the sub-sidebar tree list.
|
||||
*
|
||||
@@ -97,7 +94,7 @@ class ScheduleController extends Controller
|
||||
public function addScheduleAction()
|
||||
{
|
||||
try {
|
||||
$incident = $this->dispatch(new ReportMaintenanceCommand(
|
||||
$incident = dispatch(new ReportMaintenanceCommand(
|
||||
Binput::get('incident.name'),
|
||||
Binput::get('incident.message'),
|
||||
Binput::get('incident.notify'),
|
||||
|
||||
@@ -16,15 +16,12 @@ use CachetHQ\Cachet\Commands\Subscriber\SubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Commands\Subscriber\UnsubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class SubscriberController extends Controller
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Shows the subscribers view.
|
||||
*
|
||||
@@ -56,7 +53,7 @@ class SubscriberController extends Controller
|
||||
public function createSubscriberAction()
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new SubscribeSubscriberCommand(Binput::get('email')));
|
||||
dispatch(new SubscribeSubscriberCommand(Binput::get('email')));
|
||||
} catch (ValidationException $e) {
|
||||
return Redirect::route('dashboard.subscribers.add')
|
||||
->withInput(Binput::all())
|
||||
@@ -79,7 +76,7 @@ class SubscriberController extends Controller
|
||||
*/
|
||||
public function deleteSubscriberAction(Subscriber $subscriber)
|
||||
{
|
||||
$this->dispatch(new UnsubscribeSubscriberCommand($subscriber));
|
||||
dispatch(new UnsubscribeSubscriberCommand($subscriber));
|
||||
|
||||
return Redirect::route('dashboard.subscribers.index');
|
||||
}
|
||||
|
||||
@@ -17,15 +17,12 @@ use CachetHQ\Cachet\Commands\User\InviteTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Commands\User\RemoveUserCommand;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Shows the team members view.
|
||||
*
|
||||
@@ -84,7 +81,7 @@ class TeamController extends Controller
|
||||
public function postAddUser()
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new AddTeamMemberCommand(
|
||||
dispatch(new AddTeamMemberCommand(
|
||||
Binput::get('username'),
|
||||
Binput::get('password'),
|
||||
Binput::get('email'),
|
||||
@@ -133,7 +130,7 @@ class TeamController extends Controller
|
||||
public function postInviteUser()
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new InviteTeamMemberCommand(
|
||||
dispatch(new InviteTeamMemberCommand(
|
||||
array_unique(array_filter((array) Binput::get('emails')))
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
@@ -156,7 +153,7 @@ class TeamController extends Controller
|
||||
*/
|
||||
public function deleteUser(User $user)
|
||||
{
|
||||
$this->dispatch(new RemoveUserCommand($user));
|
||||
dispatch(new RemoveUserCommand($user));
|
||||
|
||||
return Redirect::route('dashboard.team.index')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.delete.success')));
|
||||
|
||||
Reference in New Issue
Block a user