Skip to content

Instantly share code, notes, and snippets.

@lesstif
Forked from Krato/Laravel Nova snippets.md
Created April 2, 2019 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesstif/497f496067d26c56c09093402b0fb474 to your computer and use it in GitHub Desktop.
Save lesstif/497f496067d26c56c09093402b0fb474 to your computer and use it in GitHub Desktop.
A set of snippets I use in Laravel Nova

A set of snippets I use in Laravel Nova

Snippets

Vue,js devtools (Only with manual installation)

cd ./nova 
yarn
mv webpack.mix.js.dist webpack.mix.js
yarn dev
cd ../
php artisan nova:publish

Credits: laravel/nova-issues#33 (comment)

Vue,js devtools (via composer)

cd ./vendor/laravel/nova
yarn
cp webpack.mix.js.dist webpack.mix.js
yarn dev
cd ....
php artisan nova:publish

Set default value

Text::make("Your Field")
    ->withMeta(["value" => "Some Value"]),

Credits: laravel/nova-issues#58 (comment)

Set default value to BelongsTo

BelongsTo::make('User')
    ->withMeta([
        'belongsToId' => auth()->user()->id
    ]),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment