Category : database

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’m having trouble with the foreign key. I have two tables. users table and user_address table. I’ll show you the migration. users table: public function up() { Schema::create(‘users’, function (Blueprint $table) { $table->id(); $table->string(‘name’); $table->string(‘username’)->unique()->nullable(); $table->string(’email’)->unique(); $table->timestamp(’email_verified_at’)->nullable(); $table->string(‘password’); $table->rememberToken(); $table->timestamps(); }); } and this is the user_address table: public function up() { Schema::create(‘user_address’, function (Blueprint ..

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’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 have an enum column in my migration $table->enum(‘service_dmo’, [‘DCO’, ‘SEP’, ‘SEM’])->nullable(); I want to use a multiple select in a form in my blade view, am trying this but it didn’t work: <select class="form-control @if($errors->has(‘service_dmo’)) is-invalid @endif" name="service_dmo" multiple=""> <option></option> @foreach($courrier->service_dmo AS dmo) <option value="{{ $dmo }}">{{ $dmo }}</option> @endforeach </select> Sourc..

Read more

Hye everyone! I have 2 issues:- I want to update my form but the data inside the database is not update, there is no error. Where and how to check other errors if possible? On the update popup, my dynamic dropdown did not work. Controller:- public function update(Request $req) { $usp_var = UserShiftPattern::find($req->inputUserID); $usp_var->shift_pattern_id = ..

Read more

So I was fetching data from my database to print in a table however, it says that Class "AppHttpControllersUser" not found. Here is the controller and here is how I will print the data public function directory() { $dashboardTitle = "Directory"; $isCurrent = "Directory"; $users = User::all(); return view(‘dashboard.directory’, [ ‘dashboardTitle’ => $dashboardTitle, ‘isCurrent’ => ..

Read more

I have written this code, yet I don’t know how to update the database after I perform a transaction, based on the product I purchase. Here is the MySQLi, where I think the problem is: <?php $total = $total + ($product[‘quantity’] * $product[‘price’]); mysqli_query($db, "UPDATE product set quantity = quantity-".$product[‘quantity’]." WHERE PRODUCT_ID = ‘".$product[‘id’]."’"); //$db::table(‘product’)->decrement(‘quantity’); ..

Read more

How can I get the category names for a given subject whose my case is chemistry? This is the subject.blade.php code subject.blade.php code This is my subject table subjects table This is my category table categories table This is the web view of the result Subject.blade.php web view Sourc..

Read more

I have like this query to sum user stuffs volume: $users = User::query() ->select(‘users.id’, ‘users.name’) ->selectRaw(‘SUM(user_stuffs.volume) AS total_volume’) ->join(‘user_stuffs’, ‘user_stuffs.user_id’, ‘=’, ‘users.id’) ->get(); In this case my query return only there users which total_volume greater than zero. But I need all users in my case. For example if user doesn’t has volumes then there users ..

Read more

I have an issue with my project. I am passing the data through reactjs in the front end, but the value is not getting in the backend. Can anyone say what is the problem. $cert = new certificate; $val = Validator::make($req->all(), $cert->createRules); if ($val->fails()) { return response()->json($val->errors(), 422); } $cert->prize = $req->prize; $cert->name = $req->name; ..

Read more

I’m trying to store data into a database and I encountered a situation where I don’t know is it feasible or not to do that. so I have two following tables in the database public function up() { Schema::create(‘castings’, function (Blueprint $table) { $table->increments(‘id_casting’); $table->string(‘nom’); $table->string(‘prenom’); $table->string(‘cine’); $table->string(‘date_naissance’); $table->integer(‘lieu_naissance’); $table->string(‘mineur’); $table->integer(‘id_representant’)->unsigned(); $table->timestamps(); $table->foreign(‘id_representant’)->references(‘id_representant’)->on(‘representants’); }); } ..

Read more