Unsupported driver [] - laravel-7

I have Laravel project with multiple databases project is working fine on local serve but when I uploaded my project to server its showing unsupported driver [] error Laravel version 7.0 php version 7.4
after login I am trying to get data from third database on index page but its showing error
public function index()
{
$srno = 1;
$report = DB::connection('seocrm')->table('notifications')
->join('reports', 'reports.id', '=', 'notifications.report_id')
->orderBy('reporting_date','ASC')
->get();
return view('index',compact('srno','report'));
}
here is my database.php file
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'salescrm' => [
'driver' => env('DB_CONNECTION_SECOND'),
'host' => env('DB_HOST_SECOND', '127.0.0.1'),
'port' => env('DB_PORT_SECOND', '3306'),
'database' => env('DB_DATABASE_SECOND', 'forge'),
'username' => env('DB_USERNAME_SECOND', 'forge'),
'password' => env('DB_PASSWORD_SECOND', ''),
'unix_socket' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
],
'seocrm' => [
'driver' => env('DB_CONNECTION_THIRD'),
'host' => env('DB_HOST_THIRD', '127.0.0.1'),
'port' => env('DB_PORT_THIRD', '3306'),
'database' => env('DB_DATABASE_THIRD', 'forge'),
'username' => env('DB_USERNAME_THIRD', 'forge'),
'password' => env('DB_PASSWORD_THIRD', ''),
'unix_socket' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix indexes' => true,
'strict' => true,
'engine' => null,
],
.env file
# for the first database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=hrm
DB_USERNAME=root
DB_PASSWORD=somepassword
# for the second database
DB_CONNECTION_SECOND=mysql
DB_HOST_SECOND=127.0.0.1
DB_PORT_SECOND=3306
DB_DATABASE_SECOND=salescrmdb
DB_USERNAME_SECOND=root
DB_PASSWORD_SECOND=somepassword
# for the third database
DB_CONNECTION_third=mysql
DB_HOST_third=127.0.0.1
DB_PORT_third=3306
DB_DATABASE_third=seocrmdb
DB_USERNAME_third=root
DB_PASSWORD_third=somepassword
please help to solve this error. Thanks in advance

Related

Laravel 8 Stripe: PaymentIntent could not be captured because it has a status of requires_action

I am getting the below error. The PaymentIntent could not be captured because it has a status of requires_action. Only a PaymentIntent with one of the following statuses may be captured: requires_capture. This is my code to create a 3d secure payment gateway using stripe.
if ($this->paymentMethod == 'pay') {
$stripe = Stripe::make(env('STRIPE_SK'));
try {
$token = $stripe->tokens()->create([
'card' => [
'number' => $this->card_no,
'exp_month' => $this->exp_month,
'exp_year' => $this->exp_year,
'cvc' => $this->cvc,
]
]);
if (!isset($token['id'])) {
session()->flash('stripe_error', 'Token not generated');
$this->order_success = 0;
}
$customer = $stripe->customers()->create([
'name' => $this->fname.' '.$this->lname,
'email' => $this->email,
'phone' => $this->contact,
'address' => [
'line1' => $this->door_number.' '.$this->road_name,
'postal_code' => $this->post_code,
'state' => $this->address,
'city' => $this->city,
'country' => $this->country,
],
'shipping' => [
'name' => $this->fname.' '.$this->lname,
'phone' => $this->contact,
'address' => [
'line1' => $this->door_number.' '.$this->road_name,
'postal_code' => $this->post_code,
'state' => $this->address,
'city' => $this->city,
'country' => $this->country,
],
],
'source' => $token['id']
]);
$paymentIntent = $stripe->paymentIntents()->create([
'customer' => $customer['id'],
'currency' => 'GBP',
'amount' => session()->get('checkout')['total'],
'description' => 'Paid for Order No. '.$order->id,
'confirm' => true,
'capture_method' => 'automatic',
'confirmation_method' => 'automatic',
]);
$charge = $stripe->paymentIntents()->capture($paymentIntent['id']);
if ($paymentIntent['status'] == 'succeeded') {
$this->makeTransaction($order->id, 'approved');
$this->resetCart();
} else {
session()->flash('stripe_error', 'Payment not done');
$this->order_success = 0;
}
} catch (Exception $e) {
# code...
session()->flash('stripe_error', $e->getMessage());
$this->order_success = 0;
}
}
This is happening because you create the PaymentIntent and blindly capture it right after. Will your customer be on-session for the flow? If so, it will be easiest if you follow this guide/flow. You don't handle the case that the payment method will require auth for 3DS.

i want use and/or connectors in cakedc search :its not working when i search" php+sql,java" the request dont change '+' to AND the same for',' to OR

im my model User.php
public $hasAndBelongsToMany = array(
'Competence' => array(
'with' => 'CompetencesUser',
'className' => 'Competence',
'joinTable' => 'competences_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'competence_id',
'unique' => 'keepExisting',
my $filterArgs () in my model User.php i use before to modifie my request in $query
'competences' => array(
'type' => 'subquery',
'method' => 'findByCompetences',
'field' => 'User.id',
'before'=>true)
im my function findByCompetences($data=array()) i want have cometence1 and competence2 and competence 3 or competence4
$this->CompetencesUser->Behaviors->attach('Containable', array(
'autoFields' => false
)
);
$this->CompetencesUser->Behaviors->attach('Search.Searchable');
$query = $this->CompetencesUser->getQuery('all', array(
'conditions' =>
array(
'Competence.competence' => $data['competences'],
'fields' => array(
'foreign_key'
),
'contain' => array(
'Competence'
),
'search_with_connectors' => array(
'type' => 'like',
'field' => 'Competence.competence',
'connectorAnd' => '+', 'connectorOr' => ','
)
)));
return $query;
}

Zf2 Locale in URL and $this->url

I am developing a web app on ZF2 Skeleton App base. I have played with lot of options but failed to get final headway.
I need to route the url as under:
http://myapp/
http://myapp/en/album
to AlbumController/indexAction. Also, links need to work as:
http://myapp/en/album/edit/1
http://myapp/en/album/delete/1
The code generates correct URLs but on clicking returns "404" error
My Application/module.config.php is as under:
return array (
'router' => array (
'routes' => array (
'home' => array (
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array (
'route' => '/',
'defaults' => array (
'controller' => 'Album\Controller\Album',
'action' => 'index',
'lang' => 'en',
)
)
),
'application' => array (
'type' => 'Literal',
'options' => array (
'route' => '/application',
'defaults' => array (
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index'
)
),
'may_terminate' => true,
'child_routes' => array (
'default' => array (
'type' => 'Segment',
'options' => array (
'route' => '[:lang[/album[/:action[/:id]]]]',
'constraints' => array (
'lang' => '[a-z]{2}',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+'
),
'defaults' => array (
'controller' => 'Album\Controller\Album',
'action' => 'index',
'lang' => 'en',
)
)
)
)
)
)
),
'service_manager' => array (
'factories' => array (
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory'
)
),
'translator' => array (
'locale' => 'en_US',
'translation_file_patterns' => array (
array (
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo'
)
)
),
'controllers' => array (
'invokables' => array (
'Application\Controller\Index' => 'Application\Controller\IndexController'
)
),
'view_manager' => array (
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array (
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml'
),
'template_path_stack' => array (
__DIR__ . '/../view'
)
)
);
My Album/module.config.php has the following router:
'router' => array (
'routes' => array (
'album' => array (
'type' => 'segment',
'options' => array (
'route' => '[:lang[/album[/:action[/:id]]]]',
'constraints' => array (
'lang' => '[a-z]{2}',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+'
),
'defaults' => array (
'controller' => 'Album\Controller\Album',
'action' => 'index',
'lang' => 'en',
)
),
)
)
),
////////////////////////////////////////////////////////////////////////////////////////
// Now this works fine.
Also, when I do call the $this->url('album',array('action'=>'edit', 'id' => $album->id)); in view file (.phtml), it does'nt return proper url as expected:
http://www.myapp.com/en/edit/id/1
////////////////////////////////////////////////////////////////////////////////////////
//Corrected code works for URL
$this->url('album', array('action'=>'edit', 'id' => $album->id))
///////////////////////////////////////////////////////////////////////////////////////
Appreciate your help in advance.
The issue was missing '/' in Album/module.config.php:
'route' => '[:lang[/album[/:action[/:id]]]
should have been:
'route' => '/[:lang[/album[/:action[/:id]]]
Thanks again to all for help.

Expression Engine: Create multiple publish form tabs when installing a module

Is it possible to create a module that outputs two tabs into the publish screen, or do I have two create another module to to create my second tab or just another tab.file.php file?
CODE
FILE: upd.my_module.php
class My_module_upd {
var $version = '1.0';
public function __construct(){
$this->EE =& get_instance();
}
public function install(){
$this->EE->load->dbforge();
$data = array(
'module_name' => 'My Module',
'module_version' => $this->version,
'has_cp_backend' => 'y',
'has_publish_fields' => 'y'
);
$this->EE->db->insert('modules', $data);
return true;
}
public function tabs(){
$tabs['tab_1'] = array(
'field_1' => array(
'visible' => TRUE,
'collapse' => FALSE,
'htmlbuttons' => TRUE,
'width' => '100%'
),
'field_2' => array(
'visible' => TRUE,
'collapse' => FALSE,
'htmlbuttons' => TRUE,
'width' => '100%'
)
);
$tabs['tab_2'] = array(
'field_1' => array(
'visible' => TRUE,
'collapse' => FALSE,
'htmlbuttons' => TRUE,
'width' => '100%'
),
);
return $tabs;
}
}
FILE: tab.my_module.php
class My_module_tab {
public function __construct(){
$this->EE =& get_instance();
}
public function publish_tabs($channel_id, $entry_id = ''){
$settings = array(
'field_1' => array(
'field_id' => 'field_1',
'field_label' => 'Field 1',
'field_type' => 'text',
'field_required' => 'n',
'field_data' => '',
'field_text_direction' => 'ltr',
'field_maxl' => 100,
'field_instructions' => '',
),
'field_2' => array(
'field_id' => 'field_2',
'field_label' => 'Field 2',
'field_type' => 'text',
'field_required' => 'n',
'field_data' => '',
'field_text_direction' => 'ltr',
'field_maxl' => 100,
'field_instructions' => '',
),
);
return $settings;
}
}
In the My_module_upd->tabs() method it looks like to can declare multiple tabs in the array but the My_module_tab class seems geared to controlling just one tab. Can anyone point me in the right direction?

Get a view with users who flagged me?

i'm using views and flags modules. Users can flag users. I could easily create a list of users i've flagged. But I cannot create a view with users, who flagged me.
I tried this out with a very simply Drupal install... just Core, Views 2 and Flags.
You can in fact do this. I created a Flag called flag_user_test and 3 test accounts plus admin. I flagged the admin account using the other test accounts and was able to get this list of users to display using the user id as an argument, defaulting to currently logged in user.
First, create the view to be of type User (not Node).
Next, you need to create a relationship with "Flags: User's flagged content" and select the user flag on the settings for the relationship. I did not select "Include only users who have flagged content".
Then, create an Argument using the "Flags: Content ID" type. Set this argument to use the "user flagged content" relationship you defined in the last step. I also provided the default argument to be the User ID of the currently logged in user.
Now just add the fields you want from the user profile and your done!
And here's an export of the view if you want to try it out. It looks really awful right there I know. But I don't know how to include it as an attachment, so that's the best I can do. If anyone knows how to make that code block look better, be my guest.
$view = new view;
$view->name = 'flag_me_view';
$view->description = 'User\'s who flagged me';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'flag_user_content_rel' => array(
'label' => 'user flagged content',
'required' => 0,
'flag' => 'flag_user_test',
'id' => 'flag_user_content_rel',
'table' => 'users',
'field' => 'flag_user_content_rel',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'picture' => array(
'label' => 'Picture',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'content_id' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'current_user',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'content_id',
'table' => 'flag_content',
'field' => 'content_id',
'relationship' => 'flag_user_content_rel',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Override',
),
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_node_flag_name' => 'relationship',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => 'relationship',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'flagged' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'flagged',
'table' => 'flag_content',
'field' => 'flagged',
'relationship' => 'flag_user_content_rel',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'flagged');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));

Resources