Run raw insert query or SQL file in Laravel seeder

Hey, whats up! I am working to developed a base structure for one of my SAAS application and the scenario is we need to seed good amount of data wither through Laravel seeded or from sql dump file. So, I want to do it with both - I want to run the SQL dump file … Continue reading Run raw insert query or SQL file in Laravel seeder

Send email using Gmail SMTP in Laravel 5.*

Hi there, hope you are not in trouble with your application email sending feature. I am using mailtrap.io for email testing on the development server. It is good, but one problem is all email are going mailtrap’s Demo inbox, not to users individual email. And my client wants to check all email templates and functionality … Continue reading Send email using Gmail SMTP in Laravel 5.*

Set XSRF(/CSRF) Token Globally or TokenMismatchException in Laravel 5.* (for AJAX)

Very easy (পানির লাহান) 🙂 STEP - 1: First we have to ad a meta tag (name="_token") in header <meta name="_token" content="{{ csrf_token() }}" /> STEP - 2: Then add below jQuery snippet before the </body> tag. Basically here we setting up the csrf token globally for ajax request. And after this we don't need to … Continue reading Set XSRF(/CSRF) Token Globally or TokenMismatchException in Laravel 5.* (for AJAX)

Laravel: php artisan commands

Here I am trying to list all Laravel PHP Artisan commands one by one for my reference and your too.   - To create and update table by migration php artisan make:migration Create_Table_Name  -> create a new table php artisan make:migration Update_Table_Name_Column_Name -> update table php artisan make:migration Add_Column_Name_Table_Name  -> add a new column to a table … Continue reading Laravel: php artisan commands

How to print query or debug queries in Laravel

We often need to debug large queries in Laravel. And laravel have built-in functions almost for everything. Here is a simple query in laravel for example. $data = User::where(‘status’, 1) ->select(‘name’, ‘username’, ‘email’, ‘password’) ->get();   but we want to see the sql query. So we have to use toSql() in the place of get() … Continue reading How to print query or debug queries in Laravel