Skip to content

Commit

Permalink
Merge pull request #300 from nexco-lk/main
Browse files Browse the repository at this point in the history
PR
  • Loading branch information
curtisdelicata authored Sep 27, 2024
2 parents 61305df + c76ffa0 commit 927b9f4
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Homestead.json
.phpunit.result.cache
rr
.rr.yaml
/resources/views/partials/elements/*
21 changes: 21 additions & 0 deletions app/Models/GuestLayoutManagment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;

class GuestLayoutManagment extends Model
{
Expand All @@ -16,6 +17,26 @@ class GuestLayoutManagment extends Model
'sort_order',
'is_active',
];
protected static function boot()
{
parent::boot();

static::creating(function ($model) {
self::makeComponent($model->content, $model->name);
});

static::updating(function ($model) {
self::makeComponent($model->content, $model->name);
});
}

public static function makeComponent($component, $name)
{
file_put_contents(
resource_path('views/partials/elements' . $name . '.blade.php'),
$component
);
}

public function scopeActive()
{
Expand Down
14 changes: 7 additions & 7 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public function boot(): void
});

if (config('app.debug')) {
\DB::listen(function ($query) {
\Log::info(
$query->sql,
$query->bindings,
$query->time
);
});
// \DB::listen(function ($query) {
// \Log::info(
// $query->sql,
// $query->bindings,
// $query->time
// );
// });
}
}
}
1 change: 1 addition & 0 deletions public/build/assets/app-C4dCLmVT.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resources/css/app.css": {
"file": "assets/app-gyuvcUs_.css",
"file": "assets/app-C4dCLmVT.css",
"src": "resources/css/app.css",
"isEntry": true
},
Expand Down
2 changes: 0 additions & 2 deletions resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<body>
<section>
<livewire:navigation />
<div class="font-sans text-gray-900 antialiased">
{{ $slot }}
</div>
<livewire:footer />
</section>

Expand Down
5 changes: 1 addition & 4 deletions resources/views/livewire/webrender.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<x-guest-layout>
<div>

@if ($contents)
@foreach ($contents as $element)
@include('partials.content-element', ['content' => $element['content']])
@include('partials.elements.' . $element['name'])
@endforeach
@else
<p>No content found</p>
@endif
</div>
</x-guest-layout>
4 changes: 1 addition & 3 deletions resources/views/partials/content-element.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<div class="content-element">
{!! $content !!}
</div>
{!! $content !!}

0 comments on commit 927b9f4

Please sign in to comment.