Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.
- Vehikl
- Tighten Co.
- Kirschbaum Development Group
- 64 Robots
- Cubet Techno Labs
- Cyber-Duck
- Many
- Webdock, Fast VPS Hosting
- DevSquad
- Curotec
- OP.GG
- CMS Max
- WebReinvent
- Lendio
- Romega Software
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [email protected]. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.
-
Create Proyect: composer create-project laravel/laravel project-name
-
Laravel UI: composer require laravel/ui
-
Bootstrap Auth: php artisan ui bootstrap --auth
-
Package management: npm install && npm run dev
-
Generate personal key: php artisan key:generate
-
Open Serve: php artisan serve
-
Active lines 24 and 25 in "phpunit.xml" file
-
Create DB and update line 14 in ".env" file
Omar Hevia
- php artisan migrate //migrar a DB
- php artisan make:migration courses //Crear migraciones
- php artisan migrate:rollback //Revertir cambios de la última migración
- php artisan make:migration create_nombre_table //forma correcta de crear la migración
- php artisan migrate:fresh //Incluir una nueva columna en la table y actualizar la DB "OJO ES UN MÉTODO DESTRUCTIVO"
- php artisan make:migration add_nombrecolumna_to_nombretabla_table//Añadir una columna sin borrar las tablas
- php artisan make:model name //Creación del modelo en singular
- php artisan tinker //Trabajar con eloquent. Para salir de tinker ingresar "exit"
Ejemplo:
use App\Models\Course; >>> $course=new Course; => App\Models\Course {#3548} >>> $course->name= 'Laravel'; => "Laravel" >>> $course->description= 'Learning Laravel framework'; => "Learning Laravel framework" >>> $course; => App\Models\Course {#3548 name: "Laravel", description: "Learning Laravel framework", } >>> $course->save(); => true >>> $course => App\Models\Course {#3548 name: "Laravel", description: "Learning Laravel framework", updated_at: "2022-02-01 19:33:42", created_at: "2022-02-01 19:33:42", id: 1, }
php artisan migrate:reset //eliminar todas las tablas php artisan make:factory CourseFactory --model //Crear Factory a partir del controlador php artisan make:seeder CourseSeeder //Crear un archivo seeder php artisan migrate:fresh --seed //Actualizar tabla y añadir seed
Ejemplo: Mirar la DB
use App\Models\Course $course= Course::all(); //todos los datos $course=Course::where('category','Front-End')->get(); //Obtener una categoria concreta $course=Course::where('category','Front-End')->orderBy('id', 'desc')->get(); //Obtener una categoria concreta de forma descendente $course=Course::where('category','Front-End')->orderBy('name', 'asc')->get(); //Obtener una categoria concreta de forma ascendente $course=Course::where('category','Front-End')->orderBy('name', 'asc')->first(); //Obtener primer elemento $course=Course::select('name', 'description')->get(); // para obtener las columnas específicas $course=Course::select('name', 'description')->orderBy('name', 'asc')->get(); // obtener datos específicos ordenados $course=Course::select('name', 'description', 'category')->orderBy('name', 'asc')->where('category', 'Front-End')->get(); // obtener datos específicos ordenados en category $course=Course::select('name as title', 'description', 'category')->orderBy('name', 'asc')->where('category', 'Front-End')->get(); // obtener datos específicos ordenados en category y cambiando el nombre de name $course=Course::select('name as title', 'description', 'category')->where('category', 'Front-End')->take(5)->get(); // obtener una cantidad concreta datos(5) específicos y cambiando el nombre de name $course= Course::where('name', 'Officiis distinctio velit odit aperiam incidunt.')->get(); //Acceder a dato concreto (a una colección que es un array de objetos) $course= Course::where('name', 'Officiis distinctio velit odit aperiam incidunt.')->first(); //Acceder a dato concreto dentro del array de objetos $course= Course::find(5); //Acceder al array de objetos con el id $course->description //Obtener una columna concreta $course=Course::where('id', '<=', 45)->get(); //Obtener entre un rango de id