Category : select

I’am using laravel 8, i want to get select group by from union of 3 selects and then to aply paginate, but i don’t know because dont this is not okey use IlluminateSupportFacadesDB; $contactos = DB::select(" select idcontacto, nombres, apellidos, telefono, estado, idempleado, nomVendedor, SUM(comentariosvendedor) as comentariosvendedorr, sum(totalcomentarios) as totalcomentarioss from ( SELECT c.id as ..

Read more

Estoy laravel 8, quiero hacer un select group by de la union de 3 selects y luego poder paginarlos, pero no se porque no puedo hacerlo use IlluminateSupportFacadesDB; $contactos = DB::select(" select idcontacto, nombres, apellidos, telefono, estado, idempleado, nomVendedor, SUM(comentariosvendedor) as comentariosvendedorr, sum(totalcomentarios) as totalcomentarioss from ( SELECT c.id as idcontacto, c.nombres as nombres, c.apellidos, ..

Read more

My Select option <select class="js-select2 form-control" id="reference" name="reference" style="width: 100%;" data-placeholder="Choose" multiple> <option disabled>Please Select or Create Value</option> </select> <script type="text/javascript"> $(function () { $.ajaxSetup({ headers: { ‘X-CSRF-TOKEN’: $(‘meta[name="csrf-token"]’).attr(‘content’) } }); $(‘#add_ref’).click(function () { $(‘#productForm’).trigger("reset"); $(‘#subform’).html(‘ADD<i class="fa fa-check"></i>’); $(‘#modal-popin’).modal(‘show’); }); $(‘#subform’).click(function (e) { e.preventDefault(); $(this).html(‘Sending..’); $.ajax({ data: $(‘#productForm’).serialize(), url: "{{ route(‘store_ref’) }}", type: "POST", dataType: ..

Read more

I have dynamic fields with dependent 3 level select boxes The problems is the dependent select boxes not working laravel blade <tbody class="addMoreProduct"> <tr> <td>1</td> <td> <select name="categorie_id[0]" id="categorie_id" class="form-control categorie_id " > <option value=""> choisir categorie </option> @foreach ($categories as $categorie) <option value="{{ $categorie->id }}"> {{ $categorie->categorie_name }} </option> @endforeach </select> </td> <td> <select ..

Read more

I have a query like this: $task_query = DB::table(‘table_a’) ->join(‘materials’, ‘table_a.material_id’, ‘=’, ‘materials.id’) ->join(‘products’, ‘table_a.product_id’, ‘=’, ‘products.id’) ->select( ‘table_a.colum_1’, ‘table_a.colum_2’, ‘table_a.colum_3’, ‘materials.colum_1 as material_column_1’, ‘materials.colum_2 as material_column_2’, ‘materials.colum_3 as material_column_3’, ‘products.colum_1 as product_column_1’, ‘products.colum_2 as product_column_2’, ‘products.colum_3 as product_column_3’, ) ->when( some conditions ) ->get(); This query return a flat result with all columns I ..

Read more

I have tables emails and email_attachments as follows: Schema::create(’emails’, function (Blueprint $table) { $table->id(); $table->string(’email’)->nullable(false); $table->string(‘subject’)->nullable(false); $table->text(‘body’)->nullable(false); $table->timestamps(); }); Schema::create(’email_attachments’, function (Blueprint $table) { $table->id(); $table->foreignId(’email_id’)->nullable(false); $table->string(‘file_name’)->nullable(false); $table->string(‘file_path’)->nullable(false); $table->foreign(’email_id’)->references(‘id’)->on(’emails’); }); And my models classes Email and EmailAttachment as follows: class Email extends Model { use HasFactory; protected $fillable = [’email’, ‘subject’, ‘body’]; function attachments() { ..

Read more

I am using laravel to develop an app that require an array of select option My code <select name="test_id[]" class="form-control select-test-{{$idselect}}" id="select-{{IlluminateSupportStr::random(10)}}"> <option value="">Select Patient Test</option> @foreach ($tests as $item) <option value="{{$item->id}}">{{$item->name}}</option> @endforeach </select> Laravel validation code $request->validate([ ‘test_id’ => ‘required:array’ ], [ ‘test_id.required’ => "Test is required" ]); it goes through even when no ..

Read more

my question is how stop the display priority or how to show the message for the for loop ` How to stop the display message or how to give break and show the message in the views files public function create($id) $banner = Banner::find($id); $highpriority = BannerImage::where(‘banner_id’, $id)->max(‘display_priority’); if (!$highpriority) { $highpriority = 0; } ..

Read more

Used select2 library in laravel framework for auto search on select box. My Select Box code is below, <div class="col-lg-4 col-md-6 mb-3" id="zipblock"> <select class="form-control" id="contactzipcode" name=’contactzipcode’ disabled> <option value=”>–Zip Code–</option> @if(isset($zips)) @foreach ($zips as $zipnew) <option value="{{ $zipnew->zip_id }}" {{( isset($zip_id) && $zipnew->zip_id == $zip_id) ? ‘selected’ : ” }}>{{ $zipnew->zip_code }}</option> @endforeach @endif ..

Read more

I have a livewire CRUD component to make posts. It worked perfectly before I tried to add a choice of categories. This is a piece of code, where I try to choose a category: <select class="form-select" aria-label="Default select example"> <option wire:model="category_id" selected>Выберите категорию</option> @foreach($categories as $category) <option value="{{ $category->id }}"> {{ $category->name }} </option> @endforeach ..

Read more

I have a users table. Inside there is a column called city_id. Inside the city_id column data are stored like this :for ex:["12,54,87,18"] Now I want to select user/users whose city_id exists or is equal to the $postcity variable. for ex: $postcity = 54; my code for select: $usermatchings = DB::table(‘users’) ->Where(‘city_id’, $postcity ) ->get(); ..

Read more

Have a model, from controller, I need access this Model db fields. Code in controller: $crud -> get() -> getAttributes(); //$crud->attributesToArray() print_r($crud); I was able to get entire table fields, but I need only fields, which are selected. Need dynamically show table with selected fields only, which can change during run time. Sourc..

Read more

How can I select on whereHas() some columns in relation. My current query looks like as it follows Location::select([‘title’]) ->withCount([‘job’ => function($q) { return $q->where(‘language_id’, 1)->whereNull(‘deleted_at’); }])->whereHas(‘country’, function ($q) { return $q->where(‘id’, ‘=’, 80); })->get(); and I tried Location::select([‘title’, ‘id as value’])->withCount([‘job’ => function($q) { return $q->where(‘language_id’, 1)->whereNull(‘deleted_at’); }])->whereHas(‘country’, function ($q) { return $q->select(‘title’, ‘iso3’)->where(‘id’, ..

Read more

There is a table in pma "ogsett", you need to select one line in it. In the model, Ogsett indicated which table to work with. In the controller (ServiceController) I indicated the following code <?php namespace AppHttpControllers; use AppService; use AppOgsett; use IlluminateHttpRequest; class ServiceController extends Controller { /** * Display a listing of the ..

Read more