Laravel | PHP | Basics | Part 2

Learning Laravel through Screenshots

Caching

Laravel by default supports multiple cache stores like memcached,redis,etc.
To install redis as a cache store, you should use
composer install predis/predis
predis stands for PHP redis
The default port number is 6379
Every Cache store requires a prefix which is stored in the ENV file or in the config/cache.php
Following are the cache stores supported by laravel

Blade Templates

Blade is a templating engine for views in laravel. All the files which are of type blade.php are having the extension .blade.php They are stored in the resources/views directory YOu can create suub-folders in the reosurces/views directory like layouts for all the common UI components lke header , footer, sidebar , navbar, menubar, serach bar, etc. To include the parenet file in the child blade template file , use @extends('layouts.app'). This will search for the layouts directory in the resources/views directory and the app.blade.php file in that folder
@section("content") has one attribte (or property) like it can be used in any other file . The code inside @section will be inserted in the @yield("content") line in the other blade.php file
Since blade templates are required to follow the rules of indentation, you must have a closing tag for if else if and foreach directives like
  1. @if - @elif - @else - @endif
  2. @foreach - @endforeach

Configuring Databases (MySQL)

The database is configured in the config/database.php file Here is a sample database connection

Service Providers

Laravel ships in with its own service procviders for many reasons and are stored in the config/app.php file.
You can add your own service providers in the config/app.php file by simple adding /App/Gaurav/file::class on the $providers array in the config/app.php file

Comments

Popular posts from this blog

Apache Hadoop | Running MapReduce Jobs

XPath for HTML markup