Added blog, pages, menu, category
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Blog;
|
||||
use App\Models\Menu;
|
||||
use DB;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -20,12 +22,20 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$settings = cache()->remember('app_settings', now()->addMinutes(1), function () {
|
||||
$settings = cache()->remember('app_settings', now()->addSecond(1), function () {
|
||||
return (array) DB::table('settings')->find(1);
|
||||
});
|
||||
$menus = Menu::all();
|
||||
$blogs = Blog::where(['is_published' => 1])->get();
|
||||
if ($settings) {
|
||||
config(['app.settings' => (array) $settings]);
|
||||
}
|
||||
if ($menus) {
|
||||
config(['app.menus' => $menus]);
|
||||
}
|
||||
if ($blogs) {
|
||||
config(['app.blogs' => $blogs]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user