Posts For Tag: Laravel
Laravel: Organize Your Cron Schedule In Large Application
21 Feb 2017
Laravel has a very nice way to manage your cron jobs. app/Console/Kernel.php file has a schedule() method. It accepts an instance of Schedule component and every cron task can be defined here: <?php class Kernel extends ConsoleKernel { // ......
READ MOREEloquent Outside of Laravel
15 Nov 2016
First of all, we need to install the required component via composer: composer require illuminate/database Let’s create our index.php file to start experimenting: <?php require 'vendor/autoload.php' use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule(); Capsule class is a sort of...
READ MOREMemory Leaking With A Lot Of Eloquent Queries
06 Nov 2016
Imagine, that we have a situation where we need to make a lot of queries with Eloquent in a loop. Something like this: <?php $limit = 10000; $offset = 0; while(true) { $records = Statistics::where('processed', 1) ->take($limit) ->offset($offset) ->get(); if(empty($records))...
READ MORELaravel: Automatically Add Your Console Commands To Kernel
17 Aug 2016
When your application grows and if you often use console commands, you can find out that your ‘app/Console/Kernel.php’ file may look something like this: <?php /** * * The Artisan commands provided by your application. * * @var array */...
READ MORELaravel: Problems With Migrations And SQLite
02 Aug 2016
When testing with SQLite, I’ve met several problems with migrations. Cannot add a NOT NULL column with default value NULL When you have a migration that changes columns in a table: <?php public function up() { Schema::table('users', function (Blueprint $table){...
READ MORELaravel 5.0: use database and Eloquent for logging
30 Jul 2016
Out Of Date Warning This article was published on 30 Jul 2016, this means the content may be out of date or no longer relevant. You should verify that the technical information in this article is still current before relying...
READ MORELaravel: Cache Response With Middleware
25 Jul 2016
Imagine that we want to increase the speed of our site responses. Of course, we will use cache. We can cache requests to the database, we can cache views, but we can also cache the whole response. But the response...
READ MORELaravel middleware
20 Jul 2016
So, what really means middleware? HTTP middleware provide a convenient mechanism for filtering HTTP requests, that are sent into the application. They work like the layers of the onion. When the request comes into the application it has to go...
READ MORELaravel Request Lifecycle
14 Jul 2016
Lets dive into the magic of Laravel and the way it handles http requests. First of all, the entry point for all the requests is the public/index.php file. It is usually called the front controller. The web server (Apache or...
READ MORELaravel: Invertion of Control, Dependency Injection and Container
05 Jun 2016
From Laravel documentation: The Laravel service container is a powerful tool for managing class dependencies and performing dependency injection. Here we are not going to dig in dependency injection term itself. Just notice that IoC container and dependency injection are...
READ MORELaravel: Don't Let Facades Confuse You
27 May 2016
Facade Design Pattern Let’s look at Gang of Four description of the Facade pattern: This is a structural pattern as it defines a manner for creating relationships between classes or entities. The facade design pattern is used to define a...
READ MORELaravel Multiauth: Different Versions - Different Strategies
21 May 2016
Out Of Date Warning This article was published on 21 May 2016, this means the content may be out of date or no longer relevant. You should verify that the technical information in this article is still current before relying...
READ MORELaravel: Jobs vs Events
23 Feb 2016
Out Of Date Warning This article was published on 23 Feb 2016, this means the content may be out of date or no longer relevant. You should verify that the technical information in this article is still current before relying...
READ MORE