Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update assets #9

Merged
merged 2 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions app/Classes/RenderNavItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,48 @@ public static function render(array $item, string $class = ''): string
$page = SkyPlugin::get()->getModel('Post')::page()->find($item['data']['page_id']) ?? '';
$activeClass = (request()->routeIs('page', $page)) ? $color : 'border-transparent';

return '<a class="' . $class . ' ' . $activeClass . '"
target="' . ($item['data']['target'] ?? '_self') . '"
href="' . route('page', $page) . '"
>' .
$item['label'] .
return '<a class="'.$class.' '.$activeClass.'"
target="'.($item['data']['target'] ?? '_self').'"
href="'.route('page', $page).'"
>'.
$item['label'].
'</a>';
} elseif ($item['type'] === 'post-link' || $item['type'] === 'post_link') {
$post = SkyPlugin::get()->getModel('Post')::find($item['data']['post_id']) ?? '';
$activeClass = (request()->routeIs('post', $post)) ? $color : 'border-transparent';

return '<a class="' . $class . ' ' . $activeClass . '"
target="' . ($item['data']['target'] ?? '_self') . '"
href="' . route('post', $post) . '"
>' .
$item['label'] .
return '<a class="'.$class.' '.$activeClass.'"
target="'.($item['data']['target'] ?? '_self').'"
href="'.route('post', $post).'"
>'.
$item['label'].
'</a>';
} elseif ($item['type'] === 'library-link' || $item['type'] === 'library_link') {
$tag = SkyPlugin::get()->getModel('Tag')::find($item['data']['library_id']) ?? '';
$activeClass = (str(request()->url())->contains($tag->library->first()->slug)) ? $color : 'border-transparent';

return '<a class="' . $class . ' ' . $activeClass . '"
target="' . ($item['data']['target'] ?? '_self') . '"
href="' . route('library.tag', $tag->slug) . '"
>' .
$item['label'] .
return '<a class="'.$class.' '.$activeClass.'"
target="'.($item['data']['target'] ?? '_self').'"
href="'.route('library.tag', $tag->slug).'"
>'.
$item['label'].
'</a>';

} elseif ($item['type'] === 'app-link' || $item['type'] === 'app_link') {
$activeClass = (request()->routeIs($item['data']['app_code'])) ? $color : 'border-transparent';
return '<a class="' . $class . ' ' . $activeClass . '"
target="' . ($item['data']['target'] ?? '_self') . '"

return '<a class="'.$class.' '.$activeClass.'"
target="'.($item['data']['target'] ?? '_self').'"
href="'.url(self::getAppUrl($item['data']['app_code'])).'"
>' .
$item['label'] .
>'.
$item['label'].
'</a>';
} else {
return '<a class="' . $class . '"
target="' . ($item['data']['target'] ?? '_self') . '"
href="' . $item['data']['url'] . '"
>' .
$item['label'] .
return '<a class="'.$class.'"
target="'.($item['data']['target'] ?? '_self').'"
href="'.$item['data']['url'].'"
>'.
$item['label'].
'</a>';
}
}
Expand Down
45 changes: 1 addition & 44 deletions app/Policies/CategoryPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
namespace App\Policies;

use App\Models\User;
use LaraZeus\Bolt\Models\Category;
use Illuminate\Auth\Access\HandlesAuthorization;
use LaraZeus\Bolt\Models\Category;

class CategoryPolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return bool
*/
public function viewAny(User $user): bool
{
Expand All @@ -23,10 +20,6 @@ public function viewAny(User $user): bool

/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Category $category
* @return bool
*/
public function view(User $user, Category $category): bool
{
Expand All @@ -35,9 +28,6 @@ public function view(User $user, Category $category): bool

/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return bool
*/
public function create(User $user): bool
{
Expand All @@ -46,10 +36,6 @@ public function create(User $user): bool

/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Category $category
* @return bool
*/
public function update(User $user, Category $category): bool
{
Expand All @@ -58,10 +44,6 @@ public function update(User $user, Category $category): bool

/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Category $category
* @return bool
*/
public function delete(User $user, Category $category): bool
{
Expand All @@ -70,9 +52,6 @@ public function delete(User $user, Category $category): bool

/**
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function deleteAny(User $user): bool
{
Expand All @@ -81,10 +60,6 @@ public function deleteAny(User $user): bool

/**
* Determine whether the user can permanently delete.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Category $category
* @return bool
*/
public function forceDelete(User $user, Category $category): bool
{
Expand All @@ -93,9 +68,6 @@ public function forceDelete(User $user, Category $category): bool

/**
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function forceDeleteAny(User $user): bool
{
Expand All @@ -104,10 +76,6 @@ public function forceDeleteAny(User $user): bool

/**
* Determine whether the user can restore.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Category $category
* @return bool
*/
public function restore(User $user, Category $category): bool
{
Expand All @@ -116,9 +84,6 @@ public function restore(User $user, Category $category): bool

/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return bool
*/
public function restoreAny(User $user): bool
{
Expand All @@ -127,10 +92,6 @@ public function restoreAny(User $user): bool

/**
* Determine whether the user can replicate.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Category $category
* @return bool
*/
public function replicate(User $user, Category $category): bool
{
Expand All @@ -139,13 +100,9 @@ public function replicate(User $user, Category $category): bool

/**
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return bool
*/
public function reorder(User $user): bool
{
return $user->can('reorder_category');
}

}
45 changes: 1 addition & 44 deletions app/Policies/CollectionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
namespace App\Policies;

use App\Models\User;
use LaraZeus\Bolt\Models\Collection;
use Illuminate\Auth\Access\HandlesAuthorization;
use LaraZeus\Bolt\Models\Collection;

class CollectionPolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return bool
*/
public function viewAny(User $user): bool
{
Expand All @@ -23,10 +20,6 @@ public function viewAny(User $user): bool

/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Collection $collection
* @return bool
*/
public function view(User $user, Collection $collection): bool
{
Expand All @@ -35,9 +28,6 @@ public function view(User $user, Collection $collection): bool

/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return bool
*/
public function create(User $user): bool
{
Expand All @@ -46,10 +36,6 @@ public function create(User $user): bool

/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Collection $collection
* @return bool
*/
public function update(User $user, Collection $collection): bool
{
Expand All @@ -58,10 +44,6 @@ public function update(User $user, Collection $collection): bool

/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Collection $collection
* @return bool
*/
public function delete(User $user, Collection $collection): bool
{
Expand All @@ -70,9 +52,6 @@ public function delete(User $user, Collection $collection): bool

/**
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function deleteAny(User $user): bool
{
Expand All @@ -81,10 +60,6 @@ public function deleteAny(User $user): bool

/**
* Determine whether the user can permanently delete.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Collection $collection
* @return bool
*/
public function forceDelete(User $user, Collection $collection): bool
{
Expand All @@ -93,9 +68,6 @@ public function forceDelete(User $user, Collection $collection): bool

/**
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function forceDeleteAny(User $user): bool
{
Expand All @@ -104,10 +76,6 @@ public function forceDeleteAny(User $user): bool

/**
* Determine whether the user can restore.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Collection $collection
* @return bool
*/
public function restore(User $user, Collection $collection): bool
{
Expand All @@ -116,9 +84,6 @@ public function restore(User $user, Collection $collection): bool

/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return bool
*/
public function restoreAny(User $user): bool
{
Expand All @@ -127,10 +92,6 @@ public function restoreAny(User $user): bool

/**
* Determine whether the user can replicate.
*
* @param \App\Models\User $user
* @param \LaraZeus\Bolt\Models\Collection $collection
* @return bool
*/
public function replicate(User $user, Collection $collection): bool
{
Expand All @@ -139,13 +100,9 @@ public function replicate(User $user, Collection $collection): bool

/**
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return bool
*/
public function reorder(User $user): bool
{
return $user->can('reorder_collection');
}

}
Loading