This code will iterate to all tables and columns
$excludedColumns = array("created_at", "updated_at", "deleted_at","order","key");
$tables = DB::select('SHOW TABLES');
foreach ($tables as $table) {
$tableName = data_get($table,'Tables_in_XXXX','');
$columns = Schema::getColumnListing($tableName);
foreach ($columns as $column) {
if (!in_array($column, $excludedColumns)) {
$sqlString = "select count(*) as total from $tableName where `$column` like '%$searchString%'";
$all = DB::select(($sqlString));
$x = json_decode(json_encode($all), true);
$cnt = $x[0]['total'];
if ($cnt > 0) {
Log::info("select * from $tableName where `$column` like '%$searchString%'");
}
}
}
}