Check where consistency

This commit is contained in:
James Brooks
2016-10-19 12:29:47 +01:00
parent 468b2a0b7a
commit 67b09af833
11 changed files with 14 additions and 16 deletions

View File

@@ -63,7 +63,7 @@ class ReportIncidentCommandHandler
'stickied' => $command->stickied,
];
if ($template = IncidentTemplate::where('slug', $command->template)->first()) {
if ($template = IncidentTemplate::where('slug', '=', $command->template)->first()) {
$data['message'] = $this->parseTemplate($template, $command);
} else {
$data['message'] = $command->message;

View File

@@ -56,7 +56,7 @@ class UpdateIncidentCommandHandler
*/
public function handle(UpdateIncidentCommand $command)
{
if ($template = IncidentTemplate::where('slug', $command->template)->first()) {
if ($template = IncidentTemplate::where('slug', '=', $command->template)->first()) {
$command->message = $this->parseTemplate($template, $command);
}

View File

@@ -63,7 +63,7 @@ class AddMetricPointCommandHandler
protected function findOrCreatePoint(AddMetricPointCommand $command)
{
$buffer = Carbon::now()->subMinutes($command->metric->threshold);
$point = MetricPoint::where('metric_id', $command->metric->id)->where('value', $command->value)->where('created_at', '>=', $buffer)->first();
$point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first();
if ($point) {
return $point;

View File

@@ -36,7 +36,7 @@ class SubscribeSubscriberCommandHandler
*/
public function handle(SubscribeSubscriberCommand $command)
{
if ($subscriber = Subscriber::where('email', $command->email)->first()) {
if ($subscriber = Subscriber::where('email', '=', $command->email)->first()) {
return $subscriber;
}

View File

@@ -16,7 +16,7 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi
class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
* The event listener mappings for the application.
*
* @var array
*/

View File

@@ -119,7 +119,7 @@ class ApiController extends AbstractApiController
{
$templateSlug = Binput::get('slug');
if ($template = IncidentTemplate::where('slug', $templateSlug)->first()) {
if ($template = IncidentTemplate::where('slug', '=', $templateSlug)->first()) {
return $template;
}

View File

@@ -100,7 +100,7 @@ class IncidentController extends Controller
return View::make('dashboard.incidents.add')
->withPageTitle(trans('dashboard.incidents.add.title').' - '.trans('dashboard.dashboard'))
->withComponentsInGroups(ComponentGroup::with('components')->get())
->withComponentsOutGroups(Component::where('group_id', 0)->get())
->withComponentsOutGroups(Component::where('group_id', '=', 0)->get())
->withIncidentTemplates(IncidentTemplate::all());
}
@@ -236,7 +236,7 @@ class IncidentController extends Controller
->withPageTitle(trans('dashboard.incidents.edit.title').' - '.trans('dashboard.dashboard'))
->withIncident($incident)
->withComponentsInGroups(ComponentGroup::with('components')->get())
->withComponentsOutGroups(Component::where('group_id', 0)->get());
->withComponentsOutGroups(Component::where('group_id', '=', 0)->get());
}
/**

View File

@@ -200,7 +200,7 @@ class SettingsController extends Controller
{
$this->subMenu['security']['active'] = true;
$unsecureUsers = User::whereNull('google_2fa_secret')->orWhere('google_2fa_secret', '')->get();
$unsecureUsers = User::whereNull('google_2fa_secret')->orWhere('google_2fa_secret', '=', '')->get();
Session::flash('redirect_to', $this->subMenu['security']['url']);

View File

@@ -89,7 +89,7 @@ class SubscribeController extends Controller
throw new NotFoundHttpException();
}
$subscriber = Subscriber::where('verify_code', $code)->first();
$subscriber = Subscriber::where('verify_code', '=', $code)->first();
if (!$subscriber) {
throw new BadRequestHttpException();
@@ -149,7 +149,7 @@ class SubscribeController extends Controller
$subscriber = Subscriber::where('verify_code', '=', $code)->first();
$usedComponentGroups = Component::enabled()->where('group_id', '>', 0)->groupBy('group_id')->pluck('group_id');
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
$ungroupedComponents = Component::enabled()->where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
$ungroupedComponents = Component::enabled()->where('group_id', '=', 0)->orderBy('order')->orderBy('created_at')->get();
if (!$subscriber) {
throw new BadRequestHttpException();

View File

@@ -269,8 +269,6 @@ class IncidentPresenter extends BasePresenter implements Arrayable
public function duration()
{
if ($update = $this->latest()) {
dd($update->created_at->diffInSeconds($this->wrappedObject->created_at));
return $this->wrappedObject->created_at->diffInSeconds($update->created_at);
}

View File

@@ -81,7 +81,7 @@ class Repository
$this->stale = true;
if ($value === null) {
$this->model->where('name', $name)->delete();
$this->model->where('name', '=', $name)->delete();
} else {
$this->model->updateOrCreate(compact('name'), compact('value'));
}
@@ -97,7 +97,7 @@ class Repository
*/
public function get($name, $default = null)
{
if ($setting = $this->model->where('name', $name)->first()) {
if ($setting = $this->model->where('name', '=', $name)->first()) {
return $this->castSetting($name, $setting->value);
}
@@ -115,7 +115,7 @@ class Repository
{
$this->stale = true;
$this->model->where('name', $name)->delete();
$this->model->where('name', '=', $name)->delete();
}
/**