Category : where-clause

hello all so i have a question, i have a sql database that have object array inside it, it will be like this id array 1 {"id":1032,"prc":77},{"id":1033,"prc":97} 2 {"id":1032,"prc":85},{"id":1034,"prc":97} 3 {"id":1030,"prc":85},{"id":1031,"prc":97} 4 {"id":1032,"prc":90},{"id":1033,"prc":97},{"id":1035,"prc":97} and what i want to do is take every data with id 1032 that has prc greater than 80 with its so ..

Read more

My table is look like id locale language_name 1 bn Bengali 2 en English 3 hi Hindi 4 ar Arabic 5 ja_jp Japanese My query is – $locale = ‘bn’; $languages = Language::orderBy(‘locale’,’ASC’)->where(‘locale’,$locale)->orWhere(‘locale’,’en’)->get(); I want to show – 1. If locale=’en’ Show only English (en) data 2. If locale=’bn’ Show only Bengali (bn) data 3. ..

Read more

I have just created some payment system for a school and I need to filter my data to Paid or Not Paid category. $queryBuilder = Student::query() ->leftJoin(‘fee_scheem_maps’, ‘students.students_id’, ‘=’, ‘fee_scheem_maps.sfc_student_id’) ->leftJoin(‘fee_scheems’, ‘fee_scheem_maps.sfc_feescheem_id’, ‘=’, ‘fee_scheems.fee_scheems_id’) ->leftJoin(‘individual_fee_scheems’, ‘fee_scheem_maps.sifc_feescheem_id’, ‘=’, ‘individual_fee_scheems.ifs_id’) ->leftJoin(‘fee_groups’, ‘fee_scheems.fee_scheems_id’, ‘=’, ‘fee_groups.fg_fee_scheem_id’) ->leftJoin(‘school_fee_collectors’, ‘students.students_id’, ‘=’, ‘school_fee_collectors.fc_student_id’) // ->Where(‘school_fee_collectors.fc_fee_group_id’, $fromDate) // ->orWhereNull(‘school_fee_collectors.fc_fee_group_id’, $pstatus) // ->orWhereNull(‘school_fee_collectors.fc_fee_group_id’, $fromDate) ..

Read more

I am trying to sort my table using a LIKE Database Connections: (in case anyone is wondering about this) use AppModelsHmsBbrCategory; use DB; Function: (this is inside a class extends controller) the variable $search_category has content in its text field so the else should trigger in this case public function fetchcategory($search_category){ if (empty($search_category)) { $search_where ..

Read more

I have this route on a laravel’s API application, that works good, but this time, this causes me trouble: Route::get(‘ccieActivitiesMonitoring/activity/{ccieActivityMonitoring}’, [CcieActivityMonitoringController::class, ‘ccieActivityMonitoringShow’]) ->missing(function (Request $request) { return response()->json([‘message’ => ‘not found’], 404); })->where([‘ccieActivityMonitoring’ => ‘[0-9]+’]); If a pass a number/digits to {ccieActivityMonitoring} the expected date are returned. This code giveS me this error if I’m ..

Read more

I have a branch code column (in array value) in table Users. e.g branch_code in Table User= ["01234","03333","02030"] and i have a report page where user can select the branch with select option in blade based on the user’s branch code So here is my controller $user = Auth::user(); $user_branch = $user->branch_code; $region = Branch::whereIn(‘branch_code’,[$user->branch_code])->get(); ..

Read more

I have these models below : season : public function club() { return $this->hasMany(‘AppModelsClub’); } club : public function season() { return $this->belongsTo(‘AppModelsSeason’ ,’season_id’); } public function league() { return $this->belongsTo(‘AppModelsLeague’ ,’league_id’); } league : public function club() { return $this->hasMany(‘AppModelsClub’); } the season have column called status which take value of ‘active’ or empty. ..

Read more

I have 3 table student (has many register) id score (NOT NULL) semester (NOT NULL) religion (NOT NULL) program (has many register) id score(NULL) semester(NULL) religion(NULL) register (belongsto many student and program) id score semester religion I want to find a student who is predicted to pass the program without the user having to register ..

Read more

public function Query() { $total= User::get(‘e_id’); // dd($total); foreach($total as $totals){ [$year, $month] = explode(‘-‘, $this->month); dd($totals); $s= User::whereMonth(‘date’ , $month)->whereYear(‘date’ , $year)->where(‘e_id’ , $totals)->get()->sum(‘latehours’); dd($s); } // dd($totals); } in this code the variable $totals contain value of ‘e_id’ e.g. "a-2" which it get from form when I dd($totals) it shows value e.g. "a-2" ..

Read more

public function cal1(request $request){ $request->validate([ ‘month’ => ‘required’ ]); $month1 = $request->get(‘month’); // dd($month1); $date = DB::table(‘users’)->where(‘date’, ‘==’, $month1); return Excel::download(new UsersExport($date), ‘users.xlsx’); } here is my controller, it exports the excel sheet with all the data in DB table. I want to export excel sheet having data month wise. thanks in advance. Sourc..

Read more

I have an array(or collection) like this for my notifications. Each notification has an array field for all users who has seen the notification. array:2 [ 0 => array:8 [ "_id" => "604485ddf92e0000050079c6" "title" => "Notification title" "message" => "Notification message" "type" => "success" "expire_date" => "2021-05-09T19:30:00.000000Z" "read_by_users" => array:2 [ 0 => array:2 [ ..

Read more

I have a table called Post where there are three separate columns to count post_like, post_dislike, post_react. Whenever user presses the like or dislike button value in the respective column and also value in post-react column will increment by one. I use where statement to increment the value of like/dislike. Post::where(‘id’, $id)->increment(‘post_like’); I want to ..

Read more