Compare commits
2 Commits
58426b6e4e
...
571bf4584c
| Author | SHA1 | Date | |
|---|---|---|---|
| 571bf4584c | |||
| d7dc96e11c |
@@ -18,6 +18,7 @@ use Spatie\Sitemap\Tags\Url;
|
|||||||
|
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
@@ -54,7 +55,6 @@ class Episode extends Model implements Sitemapable
|
|||||||
'title_jpn' => $this->title_jpn,
|
'title_jpn' => $this->title_jpn,
|
||||||
'slug' => $this->slug,
|
'slug' => $this->slug,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
'view_count' => $this->view_count,
|
|
||||||
'tags' => $this->tagNames(),
|
'tags' => $this->tagNames(),
|
||||||
'release_date' => $this->release_date,
|
'release_date' => $this->release_date,
|
||||||
'created_at' => $this->created_at,
|
'created_at' => $this->created_at,
|
||||||
@@ -104,10 +104,11 @@ class Episode extends Model implements Sitemapable
|
|||||||
/**
|
/**
|
||||||
* Increment View Count.
|
* Increment View Count.
|
||||||
*/
|
*/
|
||||||
public function incrementViewCount(): bool
|
public function incrementViewCount(): void
|
||||||
{
|
{
|
||||||
$this->view_count++;
|
DB::table('episodes')
|
||||||
return $this->save();
|
->where('id', $this->id)
|
||||||
|
->update(['view_count' => $this->view_count + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ return [
|
|||||||
'sortableAttributes' => [
|
'sortableAttributes' => [
|
||||||
'created_at',
|
'created_at',
|
||||||
'release_date',
|
'release_date',
|
||||||
'view_count',
|
|
||||||
'title'
|
'title'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user