From 9ef6ac90fc38dd955f0dce4d1b070b079226eb73 Mon Sep 17 00:00:00 2001 From: raza9798 Date: Fri, 9 Aug 2024 02:44:21 +0530 Subject: [PATCH 1/3] header liveware code issue fixed --- .gitignore | 1 + app/Http/Livewire/Header.php | 10 +--------- app/Http/Livewire/Homepage.php | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 98d6cbd..e292e52 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ app/storage/ # Laravel 5 & Lumen specific public/storage public/hot +public/js # Laravel 5 & Lumen specific with changed public path public_html/storage diff --git a/app/Http/Livewire/Header.php b/app/Http/Livewire/Header.php index cc54b7b..7ba1137 100644 --- a/app/Http/Livewire/Header.php +++ b/app/Http/Livewire/Header.php @@ -1,7 +1,4 @@ -/** - * Livewire component for rendering the header section of the application. - */ -<?php +featuredPosts = Post::where('is_featured', true)->get(); + $this->featuredPosts = Post::where('featured', true)->get(); } public function render() From 95eb230c19111305c7f189b17f7f5aa2b00ebbb0 Mon Sep 17 00:00:00 2001 From: raza9798 Date: Fri, 9 Aug 2024 03:14:48 +0530 Subject: [PATCH 2/3] livewire configs published --- .../App/Resources/ContentResource.php | 29 +++- config/livewire.php | 160 ++++++++++++++++++ resources/views/livewire/homepage.blade.php | 7 +- 3 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 config/livewire.php diff --git a/app/Filament/App/Resources/ContentResource.php b/app/Filament/App/Resources/ContentResource.php index d6ef253..fd29185 100644 --- a/app/Filament/App/Resources/ContentResource.php +++ b/app/Filament/App/Resources/ContentResource.php @@ -1,6 +1,25 @@ - ]), - ]); - } +modifyQueryUsing(fn ($query) => $query->with('author')); + ->modifyQueryUsing(fn($query) => $query->with('author')); } public static function getRelations(): array @@ -48,4 +67,4 @@ public static function getPages(): array 'edit' => Pages\EditContent::route('/{record}/edit'), ]; } -} \ No newline at end of file +} diff --git a/config/livewire.php b/config/livewire.php new file mode 100644 index 0000000..0d2ba89 --- /dev/null +++ b/config/livewire.php @@ -0,0 +1,160 @@ + 'App\\Livewire', + + /* + |--------------------------------------------------------------------------- + | View Path + |--------------------------------------------------------------------------- + | + | This value is used to specify where Livewire component Blade templates are + | stored when running file creation commands like `artisan make:livewire`. + | It is also used if you choose to omit a component's render() method. + | + */ + + 'view_path' => resource_path('views/livewire'), + + /* + |--------------------------------------------------------------------------- + | Layout + |--------------------------------------------------------------------------- + | The view that will be used as the layout when rendering a single component + | as an entire page via `Route::get('/post/create', CreatePost::class);`. + | In this case, the view returned by CreatePost will render into $slot. + | + */ + + 'layout' => 'components.layouts.app', + + /* + |--------------------------------------------------------------------------- + | Lazy Loading Placeholder + |--------------------------------------------------------------------------- + | Livewire allows you to lazy load components that would otherwise slow down + | the initial page load. Every component can have a custom placeholder or + | you can define the default placeholder view for all components below. + | + */ + + 'lazy_placeholder' => null, + + /* + |--------------------------------------------------------------------------- + | Temporary File Uploads + |--------------------------------------------------------------------------- + | + | Livewire handles file uploads by storing uploads in a temporary directory + | before the file is stored permanently. All file uploads are directed to + | a global endpoint for temporary storage. You may configure this below: + | + */ + + 'temporary_file_upload' => [ + 'disk' => null, // Example: 'local', 's3' | Default: 'default' + 'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB) + 'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp' + 'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1' + 'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs... + 'png', 'gif', 'bmp', 'svg', 'wav', 'mp4', + 'mov', 'avi', 'wmv', 'mp3', 'm4a', + 'jpg', 'jpeg', 'mpga', 'webp', 'wma', + ], + 'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated... + 'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs... + ], + + /* + |--------------------------------------------------------------------------- + | Render On Redirect + |--------------------------------------------------------------------------- + | + | This value determines if Livewire will run a component's `render()` method + | after a redirect has been triggered using something like `redirect(...)` + | Setting this to true will render the view once more before redirecting + | + */ + + 'render_on_redirect' => false, + + /* + |--------------------------------------------------------------------------- + | Eloquent Model Binding + |--------------------------------------------------------------------------- + | + | Previous versions of Livewire supported binding directly to eloquent model + | properties using wire:model by default. However, this behavior has been + | deemed too "magical" and has therefore been put under a feature flag. + | + */ + + 'legacy_model_binding' => false, + + /* + |--------------------------------------------------------------------------- + | Auto-inject Frontend Assets + |--------------------------------------------------------------------------- + | + | By default, Livewire automatically injects its JavaScript and CSS into the + | and of pages containing Livewire components. By disabling + | this behavior, you need to use @livewireStyles and @livewireScripts. + | + */ + + 'inject_assets' => true, + + /* + |--------------------------------------------------------------------------- + | Navigate (SPA mode) + |--------------------------------------------------------------------------- + | + | By adding `wire:navigate` to links in your Livewire application, Livewire + | will prevent the default link handling and instead request those pages + | via AJAX, creating an SPA-like effect. Configure this behavior here. + | + */ + + 'navigate' => [ + 'show_progress_bar' => true, + 'progress_bar_color' => '#2299dd', + ], + + /* + |--------------------------------------------------------------------------- + | HTML Morph Markers + |--------------------------------------------------------------------------- + | + | Livewire intelligently "morphs" existing HTML into the newly rendered HTML + | after each update. To make this process more reliable, Livewire injects + | "markers" into the rendered Blade surrounding @if, @class & @foreach. + | + */ + + 'inject_morph_markers' => true, + + /* + |--------------------------------------------------------------------------- + | Pagination Theme + |--------------------------------------------------------------------------- + | + | When enabling Livewire's pagination feature by using the `WithPagination` + | trait, Livewire will use Tailwind templates to render pagination views + | on the page. If you want Bootstrap CSS, you can specify: "bootstrap" + | + */ + + 'pagination_theme' => 'tailwind', +]; diff --git a/resources/views/livewire/homepage.blade.php b/resources/views/livewire/homepage.blade.php index ccabb21..1a2b264 100644 --- a/resources/views/livewire/homepage.blade.php +++ b/resources/views/livewire/homepage.blade.php @@ -6,12 +6,14 @@ Homepage +
@livewire('header') - @livewire('navigation') + {{-- @livewire('navigation') --}}
+
- @livewire('footer') + {{-- @livewire('footer') --}} From 7c621a5edb7b5344488368700c033ebabd0c84f9 Mon Sep 17 00:00:00 2001 From: raza9798 Date: Fri, 9 Aug 2024 03:25:03 +0530 Subject: [PATCH 3/3] resources fixed --- app/Http/Livewire/Footer.php | 21 --------- app/Http/Livewire/Navigation.php | 21 --------- app/Livewire/Counter.php | 13 ++++++ app/Livewire/Footer.php | 13 ++++++ app/{Http => }/Livewire/Header.php | 2 +- app/Livewire/Navigation.php | 13 ++++++ resources/views/livewire/counter.blade.php | 3 ++ resources/views/livewire/footer.blade.php | 2 +- resources/views/livewire/homepage.blade.php | 43 ++++++++++--------- resources/views/livewire/navigation.blade.php | 10 ++--- 10 files changed, 72 insertions(+), 69 deletions(-) delete mode 100644 app/Http/Livewire/Footer.php delete mode 100644 app/Http/Livewire/Navigation.php create mode 100644 app/Livewire/Counter.php create mode 100644 app/Livewire/Footer.php rename app/{Http => }/Livewire/Header.php (83%) create mode 100644 app/Livewire/Navigation.php create mode 100644 resources/views/livewire/counter.blade.php diff --git a/app/Http/Livewire/Footer.php b/app/Http/Livewire/Footer.php deleted file mode 100644 index a0c3881..0000000 --- a/app/Http/Livewire/Footer.php +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Livewire component for rendering the footer section of the application. - */ -<?php - -namespace App\Http\Livewire; - -use Livewire\Component; - -class Footer extends Component -{ - public function render() - { - return view('livewire.footer'); - } -} - public function render() - { - return view('livewire.footer'); - } -} diff --git a/app/Http/Livewire/Navigation.php b/app/Http/Livewire/Navigation.php deleted file mode 100644 index 35b2012..0000000 --- a/app/Http/Livewire/Navigation.php +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Livewire component for rendering the navigation bar of the application. - */ -<?php - -namespace App\Http\Livewire; - -use Livewire\Component; - -class Navigation extends Component -{ - public function render() - { - return view('livewire.navigation'); - } -} - public function render() - { - return view('livewire.navigation'); - } -} diff --git a/app/Livewire/Counter.php b/app/Livewire/Counter.php new file mode 100644 index 0000000..eb8bb00 --- /dev/null +++ b/app/Livewire/Counter.php @@ -0,0 +1,13 @@ + + {{-- Nothing in the world is as soft and yielding as water. --}} + diff --git a/resources/views/livewire/footer.blade.php b/resources/views/livewire/footer.blade.php index 1ceda1b..da313e4 100644 --- a/resources/views/livewire/footer.blade.php +++ b/resources/views/livewire/footer.blade.php @@ -1,4 +1,4 @@ -