PHP Laravel

Setting up PHP Laravel and other stages with CLI

reactimage

 
To create an app named sema with version: composer create-project laravel/laravel sema
To go to vs code:
To start coding: php artisan serve
To install routing: 

To migration                        : php artisan migrate
To migrate delete/add           : php artisan migrate:fresh
To migration with name     :  php artisan make:migration semadb --create=semadb
if cancel all migration         : php artisan migrate:reset
if reupdate one migration   : php artisan migrate:refresh --path=/database/migrations/2023_01_27_24587_admins_.php
  php artisan migrate:rollback

To seed: php artisan db:seed
To refresh seed: php artisan migrate:fresh --seed  or  php artisan migrate:refresh --seed
if reupdate one seed: php artisan db:seed --class=DatabaseSeeder
To seed diffrent way: php artisan make:model Category -f -s -m
To seed difftent way: php artisan db:seed    (php artisan db:seed --class=DatabaseSeeder)

To factory: php artisan make:factory DatabaseSeederFactory (or we use " -f " )

To Photo path (storage): php artisan storage:link

Add Control: php artisan make:controller Crud
Add Model: php artisan make:Model Crud
Add Middleware: php artisan make:middleware IsAdmin

To check if Laravel is ins...: 
To install Laravel..: 
To delete Laravel..: 

Some Terminal Ways

To enter the files: mkdir -p resources/views/back/layouts

To order to the list:

    cd C:\xampp\htdocs\sema\database\migrations

    dir

debug control: php artisan tinker

Setting

To clear: 

    php artisan optimize:clear

    php artisan config:cache    

    php artisan route:cache     

    php artisan cache:clear

    php artisan view:clear


Generating optimized autoload files:  composer dump-autoload

Update all of library: composer update

If you added new classes or renamed files: composer dumpautoload

Session setting:  php artisan session:table 



PHP LARAVEL:

  1. Modular Structure: Laravel has a modular structure, allowing code to be broken down into reusable modules (packages). These modules can be used in different projects or pages.

  1. Eloquent ORM: Laravel uses a powerful ORM (Object-Relational Mapping) called Eloquent for database operations. Eloquent makes managing database tables and relationships through models straightforward.

  2. MVC Architecture: Laravel is built on the Model-View-Controller (MVC) architecture. This architecture helps keep application development organized and maintainable.

  3. Artisan CLI: Laravel features a command-line interface called Artisan. Artisan helps automate various tasks, speeding up the development process.

  4. Blade Templating Engine: Laravel uses a lightweight and powerful templating engine called Blade. Blade makes it easy to write PHP code within HTML templates.

  5. Security: Laravel offers numerous built-in security features. These include protection against SQL injection, CSRF (Cross-Site Request Forgery) protection, and XSS (Cross-Site Scripting) attack prevention.

  6. Migrations and Seeders: Laravel uses Migrations and Seeders to manage database schema and initial data. This makes it easy to maintain database changes and synchronize development environments.

  7. Package Management: Laravel comes with Composer, a package manager. This allows for easy management of third-party libraries and packages in Laravel projects.

  8. Queue and Job System: Laravel provides a system for handling long-running tasks in the background using queues and jobs. This helps improve application performance.

  9. Events and Listeners: Laravel supports an event-driven architecture. Events and listeners allow you to define actions that are triggered when specific events occur.

  10. API Development: Laravel offers a set of tools and features for creating RESTful APIs. Packages like Laravel Passport and Laravel Sanctum help manage API authentication and authorization.

  11. Testing Support: Laravel has built-in support for unit testing and feature testing. This helps ensure the quality and reliability of your application.

Comments