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\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -54,7 +55,6 @@ class Episode extends Model implements Sitemapable
|
||||
'title_jpn' => $this->title_jpn,
|
||||
'slug' => $this->slug,
|
||||
'description' => $this->description,
|
||||
'view_count' => $this->view_count,
|
||||
'tags' => $this->tagNames(),
|
||||
'release_date' => $this->release_date,
|
||||
'created_at' => $this->created_at,
|
||||
@@ -104,10 +104,11 @@ class Episode extends Model implements Sitemapable
|
||||
/**
|
||||
* Increment View Count.
|
||||
*/
|
||||
public function incrementViewCount(): bool
|
||||
public function incrementViewCount(): void
|
||||
{
|
||||
$this->view_count++;
|
||||
return $this->save();
|
||||
DB::table('episodes')
|
||||
->where('id', $this->id)
|
||||
->update(['view_count' => $this->view_count + 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,8 +153,7 @@ return [
|
||||
],
|
||||
'sortableAttributes' => [
|
||||
'created_at',
|
||||
'release_date',
|
||||
'view_count',
|
||||
'release_date',
|
||||
'title'
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user