generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from creode-modules/feature/overwrite_views
Adds functionality to render page builder.
- Loading branch information
Showing
8 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<h1>{{ $career->title }}</h1> | ||
<p>{{ $career->location }}</p> | ||
<p>{{ $career->salary }}</p> | ||
<p>{{ $career->type }}</p> | ||
@if ($career->duration) | ||
<p>{{ $career->duration }}</p> | ||
@endif | ||
|
||
@include('page-builder::components', ['components' => $career->components]) | ||
|
||
@include('nova-careers::partials.apply-button', ['application_url' => $career->application_url]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@php | ||
$apply_url = $application_url ? $application_url : config('nova-careers.application_email'); | ||
@endphp | ||
|
||
<a href="mailto:{{ $apply_url }}">Apply</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Creode\LaravelNovaCareers\Http\Controllers; | ||
|
||
use Creode\LaravelCareers\Http\Controllers\CareerController; | ||
|
||
class NovaCareerController extends CareerController | ||
{ | ||
protected $view = 'nova-careers::career'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Creode\LaravelNovaCareers\Models; | ||
|
||
use Creode\LaravelCareers\Models\Career; | ||
use Creode\NovaPageBuilder\Services\BlockRenderer; | ||
use Illuminate\Database\Eloquent\Casts\Attribute; | ||
use Whitecube\NovaFlexibleContent\Value\FlexibleCast; | ||
|
||
class NovaCareer extends Career | ||
{ | ||
protected $casts = [ | ||
'description' => FlexibleCast::class, | ||
]; | ||
|
||
/** | ||
* Exposes a set of components from the Page Builder. | ||
* | ||
* @return Attribute | ||
*/ | ||
protected function components(): Attribute | ||
{ | ||
$blockRendererService = app()->make(BlockRenderer::class); | ||
return Attribute::make( | ||
get: function () use ($blockRendererService) { | ||
return $blockRendererService->render($this->description); | ||
} | ||
); | ||
} | ||
} |