Difference Between DDL and DML?

DML DML statements are SQL statements that manipulate data. DML stands for Data Manipulation Language. The SQL statements that are in the DML class are INSERT, UPDATE and DELETE. Some people also lump the SELECT statement in the DML classification. DML example SQL statements are below – SELECT – retrieve data from the a database INSERT – insert data into a table UPDATE – updates existing data within a table DELETE – Delete all records from a database table MERGE – UPSERT operation (insert or update) CALL – call a…

How To Integrate Facebook PHP SDK With Laravel 5.4

Facebook SDK Laravel integration image

In this article, I am explaining a simple process to set up the Facebook Marketing SDK using a PHP Artisan Command with Laravel 5.4. You can retrieve campaigns or ad account data by setting up a cron job with the created command or running it directly in the terminal. First, edit the composer.json file in the project’s root folder to include the Facebook SDK: { “require”: { “facebook/php-business-sdk”: “3.1.*” } } Next, run composer update in the terminal to pull the SDK into the vendor folder: php composer.phar install –no-dev…

Laravel Advanced how to pass variable into nested where function?

When using a variable inside a Closure scope, you must use the “use” keyword to pass the variable into the Closure: foreach ($user->locations as $location) { $r = TableName::where(‘id’, ‘<>’, $this->id) ->where(function ($q) use ($code) { // SEE HERE $q->where(‘name’, $code) ->orWhere(‘alias’, $code); }) ->get(); } If you have an array variable like $requestParam[‘name’], you need to define it before the query statement: $name = $requestParam[‘name’]; $lastRecordResult = YrModel::where(‘type’, self::table) ->where(function ($q) use ($name) { $q->where(‘name’, $name) ->orWhere(‘alias’, $name); }) ->where(‘t_id’, $requestParam[‘t_id’]) ->where(‘v_id’, $requestParam[‘v_id’]) ->count();