Skip to content

Instantly share code, notes, and snippets.

View dmason30's full-sized avatar

Dan Mason dmason30

View GitHub Profile
callback([
{ "name": "[A] OP answers follow-up questions from comments", "description": "Thanks for answering follow-up question. Unfortunately you have posted your reply as an answer to your own question. Please instead reply with a comment. Make sure to mention the person who asked the question using the <a href=\"https://meta.stackexchange.com/a/43020/316262\">@USER notation</a> so they will get notified of your reply."},
{ "name": "[A] OP adds information to question as answer", "description": "Thanks for providing additional information. Unfortunately you have posted that information as a reply to your own question, instead of editing it. Please go back to your question, <a href=\"https://meta.stackexchange.com/a/21789/316262\">edit it</a> and provide any relevant information there. This will increase your chances of getting fitting answers to your question"},
{ "name": "[Q] OP answers follow-up questions in comments", "description": "Thanks for answering follow-up questions to your question,
@dmason30
dmason30 / PublishNovaToolsCommand.php
Last active January 27, 2023 20:50
Laravel Nova combine tools command
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Http\Request;
use Laravel\Nova\Asset;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;
@dmason30
dmason30 / disabled-table-row-actions.patch
Created October 20, 2022 21:29
Displays disabled buttons on nova resource index when rows have conditional actions
Index: resources/js/components/ResourceTableRow.vue
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/resources/js/components/ResourceTableRow.vue b/resources/js/components/ResourceTableRow.vue
--- a/resources/js/components/ResourceTableRow.vue (revision 325274bea63bbff23afb280ddb4dd70dff253ca9)
+++ b/resources/js/components/ResourceTableRow.vue (date 1666301196856)
@@ -76,21 +76,22 @@
/>
@dmason30
dmason30 / Lens.php
Created November 1, 2022 10:33
Laravel Nova -> Lens to duplicate resource fields
<?php
namespace App\Nova\Lenses;
use Laravel\Nova\Http\Requests\LensRequest;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Http\Requests\ResourceIndexRequest;
use Laravel\Nova\Lenses\Lens as NovaLens;
use Laravel\Nova\Resource;
@dmason30
dmason30 / hide-table-row-actions-when-all-rows-disabled.patch
Created November 2, 2022 01:02
Hide table row actions when all rows are disabled
Index: src/Http/Resources/IndexViewResource.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Http/Resources/IndexViewResource.php b/src/Http/Resources/IndexViewResource.php
--- a/src/Http/Resources/IndexViewResource.php (revision 791a5f1d0544e11036f41c64a64128c774072212)
+++ b/src/Http/Resources/IndexViewResource.php (date 1667350406116)
@@ -3,6 +3,7 @@
namespace Laravel\Nova\Http\Resources;
@dmason30
dmason30 / NovaServiceProvider.php
Created January 27, 2023 11:47
Collapse Nova 4.20+ Menu By Default
Nova::mainMenu(function (Request $request, Menu $menu) {
$menu->items->each(function ($m) {
if ($m instanceof MenuSection && $m->items->isNotEmpty()) {
$m->collapsedByDefault();
$m->items->each(function ($m) {
if ($m instanceof MenuGroup && $m->items->isNotEmpty()) {
$m->collapsedByDefault();
}
});
@dmason30
dmason30 / nova.css
Last active October 31, 2023 18:34
Nova >=4.28.0 scrollable menu css
#nova > div:first-child > header {
margin-top: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 50
}
#nova [dusk=content] {
padding-top: 3.5rem
@dmason30
dmason30 / RedisManager.php
Last active September 7, 2023 13:42
Laravel Redis retry connections
<?php
namespace App\Extensions\Illuminate\Redis;
use Illuminate\Redis\RedisManager as LaravelRedisManager;
class RedisManager extends LaravelRedisManager
{
public function resolve($name = null)
{