Skip to content

Instantly share code, notes, and snippets.

<?php

namespace App\Nova;

class User extends Resource
{
    public static $model = 'App\\User';
    
    public static function newModel()
@dillingham
dillingham / nova-fields-kitchen-sink.md
Created September 20, 2018 04:18
all the fields for quick demo
\Laravel\Nova\Fields\Avatar::make('Avatar'),
\Laravel\Nova\Fields\Boolean::make('Active'),
\Laravel\Nova\Fields\Code::make('Snippet'),
\Laravel\Nova\Fields\Country::make('Country'),
\Laravel\Nova\Fields\Currency::make('Price'),
\Laravel\Nova\Fields\Date::make('Birthday'),
\Laravel\Nova\Fields\DateTime::make('Updated At'),
\Laravel\Nova\Fields\File::make('Attachment'),
\Laravel\Nova\Fields\Gravatar::make(),
@dillingham
dillingham / supernova.md
Last active November 13, 2018 16:52
nova alias for model, migration, resource & policy

nova bash alias

$ supernova Post

model, migration, resource, policy created!

supernova() { 
    php artisan make:model "$1" -m; 
 php artisan nova:resource "$1";
@dillingham
dillingham / nova-bulk-permissions.md
Last active February 4, 2019 04:03
Bulk assign permissions to role

Bulk assign permissions to role

Bulk assign permissions to role

Make the following 2 actions

AttachRole

@dillingham
dillingham / example.md
Created September 26, 2018 17:00
latest of BelongsToMany

Project model

public function statuses()
{
    return $this->belongsToMany('App\Status');
}

public function status()
{
config.vm.synced_folder "~/Code", "/home/vagrant/Code", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc'] # the fsc is for cachedfilesd
sudo apt-get install cachefilesd
sudo echo "RUN=yes" > /etc/default/cachefilesd
git config core.preloadindex true
@dillingham
dillingham / toolbar-button.md
Created January 7, 2019 23:34
bowersbros solution to toolbar buttons
<template>
    <div class="flex w-full justify-end items-center">
        <template v-if="hasButtons">
            <component 
                v-for="button in hasButtons" :key="button.id" :is="'detail-' + button.component" :field="button"/>
        </template>
 

Within comment resource

public static $searchRelations = [
    'post' => ['title'],
    'video' => ['title'],
];

And here is the comment model

class Comment {
@dillingham
dillingham / Steps.vue
Last active October 27, 2021 15:18
tailwind & vue stepper
<template>
<div class>
<div class="bg-grey-light h-1"></div>
<div class="flex">
<div class="flex-1" v-for="s in steps" :key="s">
<div
v-if="step >= s"
class="bg-blue -mt-1 h-1"
:class="{ 'w-1/2': step == s, 'w-full': step < s }"
></div>
export PATH=~/.composer/vendor/bin:$PATH
fresh() {
php artisan migrate:fresh
}
seed() {
php artisan db:seed