Posts

Showing posts with the label Laravel

Eloquent ORM | Laravel | Basics

Eloquent ORM Eloquent ORM: ORM stands for Ovject Relation Mapping. It converts an object to a database table row. To query the database, Eloquent has a lot of methods For example, we have a school database and inside the school database, we have a table of seventh standard The object contains the following properties. Each of the property is mapped to the column of the database If your model class is User, you should use User::all() to return all the tuples iof the database The where clause: Flight::where('active',1)->orderBy('name')->take(10)->get(); To get the first row of the row result set given by the where clause:- $flight = Flight::where('number','1000')->first(); $flight->number = '1000'; $flight->refresh(); echo $flight->number; foreach($flights as $flight) { echo $flight->name; } Flight::chunk(200, function(Collection $flights) { for...

Laravel | PHP | Basics | Part 2

Image
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 ...

Laravel | PHP | Basics | Part 1

Image
Laravel | PHP | Basics In this post, we will see the basics of laravel Laravel is a frame work on top of PHP (PHP Hypertext Preprocessor) for web artisans. When you download and install composer which is the dependency manager for PHP, you need to run the command composer install Getting started How to create a project in laravel: composer create-project laravel/laravel example-app OR composer global require laravel/installer laravel new example-app The config folder The entry point is in the config folder. In the config/database.php file, the "connection" key contains all the database drivers configuration available or provided by the laravel framework. The supported datavase drivers are sqlite mysql pgsql sqlsrv redis "mysql" => [ "driver" => "mysql", ...