Wednesday, July 5, 2017

Laravel Blade Learning

Laravel Blade Learning
echo


1. No PHP open tag / close  Tag required
2. Laravel Blade support inheritance -Header and Footer
@yield('content')
@extends("master.layout")
@section('content')
@endsection
@parent

3. We put in resource folder

4. We can put php code

5. put data with double curly bracket

6. it convert htmlentities convert

7. without {!! $data !!} without htmlentities 

8. we can use php functions {{  date("Y-m-d H:i:s")}}

9. @{{ $data }} for plain text

10. {{ $data or 'Not Available'}}

Conditions
 A.
@if (check)
@elseif(check2)
@endif
@if (!check)
 
B. unless(check)

@for
@endfor

C. @foreach
     @endforeach
D. @break

F. @forelse
    @empty
     @endforelse

@include('abc')

G. @each('div')

h. @push ('css')
    @endpush

i. @stack

j. comments {{-- --}}
   








 

Tuesday, July 4, 2017

OOPs Learning


1. What is oops
2. Inheritance- You are inheriting something
    Do Not repeate 
3. Encapsulation - We set Access Level
   -  Private can use within class
   - Protected can use for inherit class
   - public can use anyone

4. Abstract classses
   - Means Incomplete
   - Declare with Abstract
No Base Employee -
- No Object created for base class
- It uses for enforcement


5. Interfaces
  its works like abstract class
  Why Use
  Multiple class do not extends
  No variable declaration
 No constructor
You can not make private   function

6. Static Variable and Static Method
No Object Creation  required
Scope resolution operation required
It is related to class not with object
How many objects created
can call with parent :: getCount

7.Dependency Injection
   - It is design patter like mvc
   - code usability -
   - One Library can use other Library
  - DRY concept - Do not repeat yourself
- Type Hinting
You should not instantiate object inside class
 


 
 






  

 
 

Monday, July 3, 2017

Laravel Middleware Learning

1. It runs in middle
2. Application Load and before calling your function at controller
3. It works like police check
4. app/http/middleware
5. handle there is only method
6. pass parameter request , closure next  , guard
7. next is used for next middleware

example 

public function handle(Request $request, Closure $next , guard null){

return $next($next)
}


8. Generate through command line
php artisan make:middleware Test

9. Route::get("/",function(){
 echo "Hello World";
})->middleware(''Log");

Route::get("/",function(){
 echo "Hello World";
},middleware =['test','test2']);

Route::get("/",function(){
 echo "Hello World";
},middleware =['web']);



10. Register middleware
There is 2 types of Kernel
app/http/Kernel.php

Three types of middeware
$middleware
$middlewareGroups
$routeMiddleware

Add in
$routeMiddleware

'logger' => \App\Http\Middleware\LoggerMiddleWare::class,

10.
Route::group(["prefix"=>'admin','middleware'=['web']],function(){
}); 

11. Route::post("/doTest",['uses'=>"AdminController",'middleware' => ['test','test2'] )
 

12. AdminController extends Controller {

  public function __construct(){
   $this->middleware(['auth','web'], 'only'=>['dashboard']);

 }

public function __construct(){
   $this->middleware(['auth','web'], 'except'=>['dashboard']);
$this->middleware('admin', 'only'=>['postMethod']);

 }
}