Right now I've got this in my Settings.php model:
public function scopeFromCache($query)
{
\Cache::rememberForever('settings', function () use ($query) {
return $query->first();
})->first();
}
Then in the boot method from my AppServiceProvider I do this:
$settings = Settings::fromCache()->first();
Is it possible to get the settings without the ->first() like this:
$settings = Settings::fromCache();
So instead of returning a query builder return the object?
first()method is doing, returning the first object from the Collection instead of the query builder? Why don't you wanna do this?