Skip to content

Commit

Permalink
Merge pull request #225 from Dev-Pulse-Community/resources-fix
Browse files Browse the repository at this point in the history
Resources fix
  • Loading branch information
curtisdelicata authored Aug 8, 2024
2 parents fbbaa9f + 7c621a5 commit c35b4f6
Show file tree
Hide file tree
Showing 15 changed files with 270 additions and 92 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 24 additions & 5 deletions app/Filament/App/Resources/ContentResource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
]),
]);
}
<?php

namespace App\Filament\App\Resources;

use Filament\Forms;
use Filament\Tables;
use Filament\Forms\Form;
use Filament\Tables\Table;
use App\Models\ContentCategory;
use Filament\Resources\Resource;
use Filament\Tables\Columns\TextColumn;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use App\Filament\App\Resources\ContentResource\Pages;
use App\Filament\App\Resources\ContentResource\RelationManagers;

class ContentResource extends Resource
{
// public static function form(Form $form): Form
// {
// return [];
// }

public static function table(Table $table): Table
{
Expand Down Expand Up @@ -30,7 +49,7 @@ public static function table(Table $table): Table
Tables\Actions\DeleteBulkAction::make(),
]),
])
->modifyQueryUsing(fn ($query) => $query->with('author'));
->modifyQueryUsing(fn($query) => $query->with('author'));
}

public static function getRelations(): array
Expand All @@ -48,4 +67,4 @@ public static function getPages(): array
'edit' => Pages\EditContent::route('/{record}/edit'),
];
}
}
}
21 changes: 0 additions & 21 deletions app/Http/Livewire/Footer.php

This file was deleted.

21 changes: 0 additions & 21 deletions app/Http/Livewire/Header.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Http/Livewire/Homepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Homepage extends Component

public function mount()
{
$this->featuredPosts = Post::where('is_featured', true)->get();
$this->featuredPosts = Post::where('featured', true)->get();
}

public function render()
Expand Down
21 changes: 0 additions & 21 deletions app/Http/Livewire/Navigation.php

This file was deleted.

13 changes: 13 additions & 0 deletions app/Livewire/Counter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire;

use Livewire\Component;

class Counter extends Component
{
public function render()
{
return view('livewire.counter');
}
}
13 changes: 13 additions & 0 deletions app/Livewire/Footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire;

use Livewire\Component;

class Footer extends Component
{
public function render()
{
return view('livewire.footer');
}
}
13 changes: 13 additions & 0 deletions app/Livewire/Header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire;

use Livewire\Component;

class Header extends Component
{
public function render()
{
return view('livewire.header');
}
}
13 changes: 13 additions & 0 deletions app/Livewire/Navigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire;

use Livewire\Component;

class Navigation extends Component
{
public function render()
{
return view('livewire.navigation');
}
}
160 changes: 160 additions & 0 deletions config/livewire.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<?php

return [

/*
|---------------------------------------------------------------------------
| Class Namespace
|---------------------------------------------------------------------------
|
| This value sets the root class namespace for Livewire component classes in
| your application. This value will change where component auto-discovery
| finds components. It's also referenced by the file creation commands.
|
*/

'class_namespace' => '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
| <head> and <body> 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',
];
3 changes: 3 additions & 0 deletions resources/views/livewire/counter.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
{{-- Nothing in the world is as soft and yielding as water. --}}
</div>
2 changes: 1 addition & 1 deletion resources/views/livewire/footer.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<footer style="background-color: #f8f9fa; padding: 20px; text-align: center;">
<footer style="background-color: #f8f9fa; padding: 20px; text-align: center;" class="fixed bottom-0 w-full flex justify-between">
<p>&copy; {{ date('Y') }} CMS Laravel. All rights reserved.</p>
<p>
<a href="/privacy-policy" style="margin-right: 15px; text-decoration: none; color: #333;">Privacy Policy</a>
Expand Down
Loading

0 comments on commit c35b4f6

Please sign in to comment.