informatica:programacion:php:frameworks:laravel
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| informatica:programacion:php:frameworks:laravel [2025/03/12 13:03] – [Tinker: para pruebas] tempwin | informatica:programacion:php:frameworks:laravel [2025/03/31 15:30] (actual) – [Modelos] tempwin | ||
|---|---|---|---|
| Línea 609: | Línea 609: | ||
| === Modelos === | === Modelos === | ||
| - | Para crear un nuevo modelo Eloquent: | + | Para crear un nuevo modelo |
| <code bash> | <code bash> | ||
| Línea 724: | Línea 724: | ||
| <code bash> | <code bash> | ||
| php artisan make:model --help | php artisan make:model --help | ||
| + | </ | ||
| + | |||
| + | ==== Información ==== | ||
| + | |||
| + | Para mostrar la información de un modelo: | ||
| + | |||
| + | <code php> | ||
| + | php artisan model:show < | ||
| + | </ | ||
| + | |||
| + | Por ejemplo: | ||
| + | |||
| + | < | ||
| + | $ php artisan model:show User | ||
| + | |||
| + | App\Models\User | ||
| + | |||
| + | Table: users | ||
| + | Connection: mysql | ||
| + | Primary key: id | ||
| + | Incrementing: | ||
| + | With: [] | ||
| + | WithCount: [] | ||
| + | Belongs to Many: [] | ||
| + | |||
| + | Attributes: | ||
| + | id: int (auto-increment) | ||
| + | name: string | ||
| + | email: string | ||
| + | meta: array (cast) | ||
| + | created_at: Illuminate\Support\Carbon (cast: datetime) | ||
| + | updated_at: Illuminate\Support\Carbon (cast: datetime) | ||
| + | |||
| + | Relationships: | ||
| + | posts(): HasMany(App\Models\Post) | ||
| + | 🔑 Foreign key: user_id | ||
| + | 🗝️ Owner key: id | ||
| + | |||
| + | Methods: | ||
| + | getEmailVerifiedAtAttribute() | ||
| + | setPasswordAttribute($value) | ||
| + | |||
| </ | </ | ||
| ==== Servidor web de desarrollo ==== | ==== Servidor web de desarrollo ==== | ||
informatica/programacion/php/frameworks/laravel.1741781009.txt.gz · Última modificación: por tempwin
