Skip to content

Instantly share code, notes, and snippets.

@rossanoua
Forked from Krato/Laravel Nova snippets.md
Created April 21, 2019 06:22
Show Gist options
  • Save rossanoua/bf107ed609a973a7a83bc2b8d8b527bc to your computer and use it in GitHub Desktop.
Save rossanoua/bf107ed609a973a7a83bc2b8d8b527bc 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