Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

OOP – Programming Paradigm based concept of objects

Classes are templates used in object-oriented programming to create objects, which are instances of that class.

Object is an instance of a class that defines what property, variable or functions of the class.

If the class instantiated it’s called object

No need to declare or to define over and over again

Inheritance – Sharing of Information (Extend all properties, functions, methods etc. from parent class to child class)

Encapsulation – Grouping of information (All functions and characteristics are related to the class)

Abstraction – Hiding of information (Hiding certain details and showing only essential info to the users)

Polymorphism – Redefining of Information (Overriding the methods of the child class of her parent class)

Public and Private is Access Modifier.

LARAVEL

Installation

PHP Composer – Node.Js – Xampp with PHP > 7.2

- composer global require Laravel/installer


- Laravel new .

Resources -> Views -> welcome.blade.php

App -> Providers -> User.php (Model)

App -> Http -> Controllers -> controller.php

Route ->

Database configuration -> .env file

Xampp – Apache – config – config.inc.php -> auth_type = cookie

Artisan is a console or command line of Laravel

Php artisan serve

Npm install

Npm run dev = compile the projects

Php artisan migrate

Composer require laravel/ui

Php artisan ui vue –auth


Php artisan migrate

Php artisan serve

Npm run dev

Php artisan migrate:fresh

Php artisan make: controller

Dd($user) = Die and Dump

Middleware – methods that required login before access dashboard

Laravel includes a middleware that verifies whether the user of the application is authenticated or not.

Postman = tool for verifying API and interact with HTTP API

Get = request method to get general information to the server

Post = request method that used when we need to send additional information

Put = request method where the client sends data that updates the entire resources

Patch = request method where the client sends data that updates the partial resources

Delete = request method where the client needs to remove the entire resources

Symfony root PHP Framework

Laravel is PHP Framework

Benefits of Laravel

- Template Tools
- Authentication and Authorization
- Inbuilt Libraries
- URL Generations
- MVC Architecture Support
- Artisan Tool Command Line

Separate into 3 major components

Model – Data related Logic that interact with the database.

View – UI logic for Users view.

Controller – Acts as interface between Model and View Components.


sa Laravel kasi pede ka na mag gawa ng table or fields then using yun build id structure na pag create field sa table ng
database... pede na gawin using yun laravel migration.. na hindi na pupunta sa table at dun mag lalagay ng fields or mag
add ka pa ng bagong table

Eloquent

Public function users()

return $this->hasMany(User::class, 'user_id', '_id');

Query Builder:

SELECT id, fname, lname, work_id work.name FROM user

OUTER JOIN work ON work.id = user.work_id;

Eloquent query in a OOP manner easy to use than query builder.

1. Queries are highly readable while written using Eloquent comparing with Query Builder.
2. You can use methods, scopes, accessors, modifier etc inside of a Model which is easy to maintain.

Since tokens are generally used in API authentication,


Laravel Passport provides an easy and secure way to implement token authorization on an OAuth 2.0 server.

How to call and fetch data from database to Vue?


Most of the time kasi ang mostly nagagamit dyan kay Vue for fetching data, through HTTP Request
from frontend to backend is Axios. Axios is an HTTP Framework.

JSON Web Token (JWT) is an open standard that allows two parties to securely send data and information as
JSON objects. This information can be verified and trusted because it is digitally signed. JWT
authentication has aided the wider adoption of stateless API services.

JWT is a token format. OAuth is an authorization protocol that can use JWT as a token.

Since HTTP driven applications are stateless, sessions provide a way to store information about the user across
requests.

You might also like