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']);

 }
}




Thursday, June 29, 2017

Helper Method in laravel

1. view
2.

Laravel Routing

1. Route::any("test",function(){

});

2. Route::match(['get', 'post'], '/test', function () {
});
 
 
3. Route::get("abc", TestController@abcFunction);
 
4. Route::post("abc", TestController@abcFunction); 
 
5. Route::controller('admin', TestController); missingMethod($parameter=array)
 
6. php artisan route:list
 
7. Route(/test/{number}, TestController@test);
 
8. Route::get('user/{name}', function ($name) {})->where('name', '[A-Za-z]+'); 
 
9. Route::middleware(['first', 'second'])->group(function () {
    Route::get('/', function () {
        // Uses first & second Middleware
    });

    Route::get('user/profile', function () {
        // Uses first & second Middleware
    });
});
 
10. Route::namespace('Admin')->group(function () {
    // Controllers Within The "App\Http\Controllers\Admin" Namespace
});  
 
11. Route::group(["prefix"=>'admin','middleware'=['web']],function(){
}); 
 
12. Route::controller("admin-panel", ) 
 

Thursday, June 15, 2017

Sublime Learning

Create Project In Sublime

Select Project . It will select all files


1. Open Window in tab
command + ,
"open_files_in_new_window": false


2. Find + Replace
commmand + alt()  + F

3. Search File in particular directory

Command +P

4. Search  functions
Command + R


5. Switching File
Shift+Command + ] and shift + Command + [








Learning Laravel




If Not installed composer install it

curl -sS https://getcomposer.org/installer | php




sudo mv composer.phar /usr/local/bin/
vim ~/.bash_profile
alias composer="php /usr/local/bin/composer.phar"
composer global require "laravel/installer"
export PATH=~/.composer/vendor/bin:$PATH


Create Project In Laravel
 
laravel new blog
composer update --no-scripts 
cp .env.example .env
php artisan key:generate
 
 
Open .env file 
Change User name and Password  and database for mysql
php artisan migrate
 
create table in laravel
php artisan make:migration create_users_table --create=users 
 
php artisan migrate 
 
php artisan make:model Task 

1. Routes files
app/http/routes.php


2. view files
resources/views/

3. js/css files
public
authController.js

4. Query Enabling

DB::enableQueryLog();
      
DB::getQueryLog();

Wednesday, June 14, 2017

Mac(OSX) MONGODB PHP Driver

brew doctor
 
brew update
 
brew upgrade  

xcode-select --install

brew install pkg-config

brew install autoconfbrew install openssl

ln -s ../opt/openssl/include/openssl .

sudo pecl install mongodb

sudo cp /etc/php.ini.default /etc/php.ini

php -i | grep php.ini

subl /etc/php.ini

sudo apachectl restart

Monday, May 15, 2017

Mac Learning


1.  Double Click
        - Click with 2 fingers

2.  Home Button
       - Command + Left Key

3.  End Button 
       - Command  + Right key

4.  Page Up
      - Command + Up Key

5.  Page down
       - Command + Down Key

6.  Start of document
      - Fn + up key

7.  end of document
      Fn + down key

8. To Go Desktop
    Fn + F11

9.  Install subversion
brew install subversion

10. Set up Ssh

https://docs.joyent.com/public-cloud/getting-started/ssh-keys/generating-an-ssh-key-manually/manually-generating-your-ssh-key-in-mac-os-x


11. set sort command
nano .bash_profile
alias test="command"

12. Delete current cursor
ctrl +D

13. print screen and desktop
shift +command + 3

14.  print screen in cursor
shift + command + ctrl +3

15. Best SQL connector
Sequel Pro

16. Best Editor
Sublime

17. Delete anything
Command + delete

18. option + command  + Q


19. Sublime replace in mac
commad + option +f

20. find and replace in nano
ctrl + \


21. start apache , stop and restart
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
apachectl configtest


22. Apache version
httpd -v

23. Apache troubleshott
pachectl configtest
 
 
24.System Level Web Root
/Library/WebServer/Documents/
 
  
25. Setup php
http://www.alphansotech.com/blogs/setup-apache-mysql-php-phpmyadmin-mac-osx/


26. run command with super user
sudo su -


27. Clean up by Name
command + option +1