I am having trouble running the following prepared statement in Laravel: I get the following error: [2017-06-08 03:41:35] local.ERROR: PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if…
Tag: laravel
Invalid datetime format: 1292 Incorrect datetime value – Laravel 5.2
I’m getting this error when I insert these value into my database table: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ’24/06/2017′ for column ‘registration_from’ at row 1 (SQL: insert into `campus_registrations` (`campus_major_class_id`, `registration_…
Laravel Update not working
I have table called admins and model called Admin. When i try to update the records it fails every time with one field. Above code is not updating record in DB. datatype for is_delete is tinyint. If i update name field it works with the same code like Can you help me why first code is not working. Answer Mode…
Do not stop loop when query fails. LARAVEL
I am uploading a .csv file to a controller in my laravel application, and the controller loops through all the rows of the file and create new rows in my database. I works pretty well, but the problem is that if one of the rows of the CSV has a problem, the loop will be stopped and the web page
Laravel Passport Get Client ID By Access Token
I’m writing a tiny sms gateway to be consumed by a couple of projects, I implemented laravel passport authentication (client credentials grant token) Then I’ve added CheckClientCredentials to api middleware group: The logic is working fine, now in my controller I need to get client associated with…
In Laravel, how do I retrieve a random user_id from the Users table for Model Factory seeding data generation?
Currently, in my ModelFactory.php, I have: I would like to generate a random user_id from one of the user ID’s already stored in the user table. I’m stumped because I don’t know the way to display data output to code properly, and I was wondering how I would be able to allow Laravel to choos…
Class ‘NumberFormatter’ not found in Laravel 5.4
I’m trying to use PHP’s intl extension to convert amount into words. For example, 1450 -> One Thousand Four Hundred and Fifty I’m using Laravel 5.4 that runs on XAMPP 3.2.2 server with PHP 5.6.24. As mentioned in similar questions, I’ve already enabled the intl PHP extension by unco…
how to force delete in laravel 5.4
I made a user management system with soft deletion and force deletion options. However, I’m having trouble getting the force deletion option to work. The route: Route::post(‘users/{user}/delete’, ‘…
{Carbon} Convert time in HH:MM:SS format into seconds in Laravel?
I want to convert the time which I got from $scheduleTime = Carbon::createFromTimestampUTC($scheduleTimestamp)->toTimeString(); which is currently giving me 07:32:40 now I want to convert it into …
localization FakerFactory does not work in laravel
I have a Post Model with these fields : Now I want to use laravel sedders and model factories to create fake fa_IR localized data and insert to posts table. For that I wrote this in database/factories/ModelFactory.php: Then I created a PostsTableSeeder class like this : And in AppServiceProvider.php added bel…