Difference between revisions of "Creating models in Laravel Nova"

From Wiki | Valse Technologies
Jump to navigation Jump to search
Line 6: Line 6:
 
2. Create the same Model.php in app/Nova
 
2. Create the same Model.php in app/Nova
 
   - Create manually in app/Nova or type 'php artisan nova:resource Post' in composer.
 
   - Create manually in app/Nova or type 'php artisan nova:resource Post' in composer.
 +
 +
3. Grouping resources
 +
  - For example: put 'public static $group = 'Admin';' if you wish to put the model is under '''Admin''' heading

Revision as of 08:45, 7 November 2019

1. Using composer, type 'php artisan make:model Model'

  - Model are named after table in database in singular term. 
  - Eg. users(table) --> User.php (models)
  - Folder: app/Model.php

2. Create the same Model.php in app/Nova

  - Create manually in app/Nova or type 'php artisan nova:resource Post' in composer.

3. Grouping resources

  - For example: put 'public static $group = 'Admin';' if you wish to put the model is under Admin heading