Created
August 27, 2023 12:31
-
-
Save kirkbushell/935e0529d809bd18178b4e497f7aedf9 to your computer and use it in GitHub Desktop.
Updated syntax for supporting caches in Eloquence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Eloquence\Behaviours\CountCache\CountedBy; | |
use Eloquence\Behaviours\CountCache\HasCounts; | |
use Illuminate\Database\Eloquent\Model; | |
class Post extends Model { | |
use HasCounts; | |
#[CountedBy] | |
public function author(): BelongsTo | |
{ | |
return $this->belongsTo(Author::class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment