Merge pull request #358 from githubertus/patch-2

Make charts on dashboard work
This commit is contained in:
Sam Bell 2018-04-25 08:17:51 +01:00 committed by GitHub
commit 7514aa4ba8
1 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class EventStats extends \Illuminate\Database\Eloquent\Model
*/
public function updateViewCount($event_id)
{
$stats = $this->firstOrNew([
$stats = $this->updateOrCreate([
'event_id' => $event_id,
'date' => DB::raw('CURRENT_DATE'),
]);
@ -72,7 +72,7 @@ class EventStats extends \Illuminate\Database\Eloquent\Model
*/
public function updateSalesVolume($event_id)
{
$stats = $this->firstOrNew([
$stats = $this->updateOrCreate([
'event_id' => $event_id,
'date' => DB::raw('CURRENT_DATE'),
]);
@ -92,7 +92,7 @@ class EventStats extends \Illuminate\Database\Eloquent\Model
*/
public function updateTicketsSoldCount($event_id, $count)
{
$stats = $this->firstOrNew([
$stats = $this->updateOrCreate([
'event_id' => $event_id,
'date' => DB::raw('CURRENT_DATE'),
]);