Model Relations
Questo comando genera le le relazioni del model dato in input.
⚠️ ATTENZIONE ⚠️
Il comando in output fornisce solamente i metodi che dovrebbero esistere nel model, non aggiunge nulla
Per avere l'output citato in precedenza, è sufficiente lanciare sul terminale:
Utilizzo
bash
artisan weconstudio:model:relations User
Copia output nella clipboard (macOS)
bash
artisan weconstudio:model:relations User | pbcopy
Esempio di output:
php
/**
* [DB]
* note_categories [id, user_id, name, ...]
* notes [id, note_category_id, title, description, ...]
*
* [COMMAND]
* sail artisan weconstudio:model:relations NoteCategory
*
**/
public function notes(): HasMany
{
return $this->hasMany(Note::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}