Category : mysql

I am trying to create procedure migration in laravel but I am getting syntex error every time I tried so but didn’t make it work Below is the code $this->addSql("CREATE PROCEDURE Type_Store_Sync(IN name_it VARCHAR(255), IN guid VARCHAR(32), IN type VARCHAR(10), IN orgid INT(11), IN scheme VARCHAR(6)) LANGUAGE SQL BEGIN CALL mysql.lambda_async( ‘arn:aws:lambda:eu-west-2::function:triggersync’, CONCAT(‘{ "name" : ..

Read more

I am new in Laravel. I have a table, and that table name is {status}. Under the Models Status.php when I removed protected $table=’status’; from status.php then I am getting this error! IlluminateDatabaseQueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘cms.statuses’ doesn’t exist (SQL: insert into statuses (status, user_id, updated_at, created_at) values (dfg, ..

Read more

I am trying to fetch a grouped By list of all my Summaries with the according Sum of the total field. To visualise it it would look something like this ID. Code. Total. Created_at. Updated_at 1 61B5A4C5 1437.64 2021-06-22 11:18:09 2021-06-22 11:18:09 2 A9B5311C 711.44 2021-06-22 11:19:10 2021-06-22 11:19:10 3 1426CDC5 711.44 2021-06-22 11:19:27 2021-06-22 ..

Read more

I need to understand what’s going on with my model instance. I have setup and many-to-many relationship in my User model public function projects(){ return $this->belongsToMany(Project::class, ‘project_users’, ‘user_id’, ‘project_id’)->withPivot(‘role’)->withTimestamps(); } When a user logs in, I return an instance of the user model $user = User::where(’email’, $request->email)->first(); return response([ ‘message’ => ‘User Logged in’, ‘data’ ..

Read more

i have 3 row data in database , i want query to make it become 1 data by its id , what should i do to get 1 row content like : |operator_id|durasi_jam_kerja|durasi_jam_lembur|durasi_jam_standby|         9                                                    2                               8 Sourc..

Read more

I wanted to call the number of files uploaded by the user through its id but it shows that the fileuploads is not defined. Can aynone help me on this? Here is the function for it public function dashboard() { $dashboardTitle = "Dashboard"; $isCurrent = "dashboard"; $filesUploadCount = Fileupload::where(‘user_id’, Auth::user()->id) ->count(); return view(‘dashboard.index’, [ ‘dashboardTitle’ ..

Read more

I’m building a SPA with Laravel and Vue. However, I need to make an API call with axios but it’s not working. Here’s my web.php: Route::get(‘/{any}’, function () { return view(‘index’); })->where(‘any’, ‘.*’); Here’s my api.php route: Route::get(‘/notification’, ‘[email protected]’); Whenever I make an API call, it shows a blank or broken page. Could you please ..

Read more

I am using Laravel migration and each and everything is working fine on my side. I am using a work bench with ubuntu. But when I export data on CPanel it shows an error Error SQL query: — — Dumping data for table `activity_log` — LOCK TABLES `activity_log` WRITE MySQL said: Documentation #1146 – Table ..

Read more

I am using Laravel migration and each and everything is working fine on my side. I am using a work bench with ubuntu. But when I export data on CPanel it shows an error Error SQL query: — — Dumping data for table `activity_log` — LOCK TABLES `activity_log` WRITE MySQL said: Documentation #1146 – Table ..

Read more

Here’s my JSON: [ { "ID": 1, "SOURCEID": 1, "TIMESTAMP": "2020-04-05 07:05:29", "VALUE": "30" }, { "ID": 4, "SOURCEID": 2, "TIMESTAMP": "2020-04-05 07:05:17", "VALUE": "40" }, { "ID": 3, "SOURCEID": 1, "TIMESTAMP": "2020-04-06 12:04:59", "VALUE": "35" }, { "ID": 5, "SOURCEID": 1, "TIMESTAMP": "2020-06-17 12:01:32", "VALUE": "1" }, { "ID": 6, "SOURCEID": 2, "TIMESTAMP": "2021-06-17 ..

Read more

I’m trying to add an user to data base in latavel. following is my User Model. <?php namespace AppModels; use IlluminateContractsAuthMustVerifyEmail; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateNotificationsNotifiable; use SpatiePermissionTraitsHasRoles; class User extends Authenticatable implements MustVerifyEmail { use HasFactory, Notifiable, HasRoles; /** * The attributes that are mass assignable. * * @var array */ ..

Read more

I am running a sql in Laravel: $last_reading_comprehension_id = DB::select( DB::raw(" INSERT INTO `npee_reading_comprehensions`(npee_id) VALUES ($npee->id),($npee->id),($npee->id),($npee->id); SELECT LAST_INSERT_ID(); ") ); this will fail with errors but when I run the sql directly in mysql, it works Why it that? How can I solve it, thanks a lot for anyone help! Sourc..

Read more

I’m using laravel casts inside my model to cast my timestamps to date:Y/n/j. But laravel casts it to wrong date. model: class Diary { protected $casts = [ ‘created_at’ => ‘date:Y/n/j’, ]; app.php: ‘timezone’ => ‘Asia/Tokyo’, php.ini: date.timezone = "Asia/Tokyo" mysql: select * from diaries; +—-+——-+———————+ | id | diary | created_at | +—-+——-+———————+ | ..

Read more

I am trying to call my table contents using ajax append from a laravel controller function. I am getting this error though Ajax: function fetchcategory() { $.ajax({ type: "GET", url: "/clinical/bbr-category-configuration-data", dataType: "json", success: function (response){ // console.log(response.all_categories); $.each(response.all_categories, function (key, item) { $(‘tbody’).append(‘<tr> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> </tr>’); }); } }); } Controller: (tabled ..

Read more

[20-Jun-2021 14:57:53 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘0’ for key ‘PRIMARY’ in /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:464 Stack trace: #0 /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(464): PDOStatement->execute() #1 /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(664): IlluminateDatabaseConnection->IlluminateDatabase{closure}(‘insert into tr…’, Array) #2 /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(631): IlluminateDatabaseConnection->runQueryCallback(‘insert into tr…’, Array, Object(Closure)) #3 /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(465): IlluminateDatabaseConnection->run(‘insert into tr…’, Array, Object(Closure)) #4 /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(417): in /home2/islamage/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 671 [20-Jun-2021 14:57:53 ..

Read more