Category : sql

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 have a table of players with a field called name (which is a string, of course). When adding a player to the database, I check for uniqueness using a custom rule: public function passes($attribute, $value) { return !($this->players->where(‘name’, $value)->count()); } This works most of the time. I noticed, however, that strings are cast to ..

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 am trying to execute the following code, the error applies to the $waitingToBeShipped… section of the code. As you can see I am using an innerJoin. I want to retrieve all of the rows that have orders containing products that are still waiting to be shipped. public function destroyMany($ids) { $status = false; $ids ..

Read more

Demonstration on how my catagory_id is being read (console.log each time I press the edit button) $(document).on(‘click’,’.edit_category’,function (e) { e.preventDefault(); var cat_id = $(this).val(); console.log(cat_id); }); My problem is when I try to output the an array shown at the consoles by clicking the edit button (testing purposes) Not sure how I still get the ..

Read more

I have a problem with inserting into db i don’t know why laravel can’t catch field firstname there is an error my database Controller <?php namespace AppHttpControllers; use AppModelsAuthor; use AppModelsBook; use IlluminateHttpRequest; class AuthorController extends Controller { /** * Display a listing of the resource. * * @return IlluminateHttpResponse */ public function index() { ..

Read more

I am trying to output an if condition on my two columns in my laravel ajax: $.each(response.all_categories, function (key, item) { $(‘tbody’).append(‘<tr> <td><p class="font-weight-bold mb-0">’+item.category_name+'</p>’+item.category_description+'</td> <td>View: if (‘+item.config_view_type+’ == ‘P’){ <mark class="mark-orange">Public</mark> } elseif (‘+item.config_view_type+’ == ‘R’){ <mark class="mark-orange">Restricted</mark>} <br>Edit: </td> <td>View: </td> <td> <button type="button" value="’+item.category_id+’" class="btn btn-outline-secondary"> <i class="fas fa-edit"></i> Edit</button><button type="button" value="’+item.category_id+’" ..

Read more

When I try to load a page in my laravel project which requires data from the sql db, I the browser outputs the following error: SQLSTATE[HY000] [1045] Access denied for user ‘remotogl_web’@’localhost’ (using password: YES) (SQL: select * from `issues`). as well as the stack trace with header: IlluminateDatabaseConnection::runQueryCallback C:FilesWorkWebsitesremoto-webvendorlaravelframeworksrcIlluminateDatabaseConnection.php:692 I’m aware there are somewhat ..

Read more

I have a Ticket model, which has polymorphic relationship with its subtypes, EquipmentTicket and OfficeSuppliesTicket. After support receives a ticket, they need to submit a PurchaseOrder based on that ticket to HR. PurchaseOrder behaves like a ticket and has similar API, but considering business logic, it makes sense to me that these two terms are ..

Read more

I’m using Laravel query builder to retrieve results from db but it shows me empty array but whenever i use raw query it shows me results. Any solutions? RAW query (showing results) $work_query = ‘SELECT * FROM work_availability WHERE EmployeeID = ‘ . $id . ‘ AND Position LIKE "%’ . $r->position . ‘%" AND ..

Read more

I am trying to add two columns: id and category_id and I need both to be the same value $category = new HmsBbrCategory; $category->id = increments(); $category->category_id = id+1; $category->category_name = $request->input(‘category_name’); $category->category_description = $request->input(‘category_description’); $category->save(); return response()->json([ ‘status’=>200, ‘message’=>’Category Added!’, ]); as you can see, both columns return null, tried adding two lines but ..

Read more

There a few schools under HQ and same things goes to franchise. I want to create a dropdown list when I click "Centre" to create new data, it will also create a new data for the all schools who have been group by centre Here is my controller $this->centre= $this->db->get_where(‘schools’, array(‘group_by’=>’centre’))->result(); And this is views ..

Read more

Still new to laravel, learning how the $request interacts with create. here is my form for two of my variables for context: <form method="POST" id="postForm"> {{– @csrf –}} <input type="hidden" id="id_hidden" name="id" /> <div class="form-group"> <label for="title"> Title <span class="text-danger">*</span></label> <input type="text" name="title" id="title" class="form-control"> </div> <div class="form-group"> <label for="category_description"> Description <span class="text-danger">*</span></label> <textarea name="category_description" ..

Read more

It is working but I should do with Relaion SELECT * FROM product JOIN ware_houses ON product.id=ware_houses.product_id WHERE ware_houses.variant_id=1; Like this… Product::whereHas(‘ware_houses’)->where(‘ware_houses.product_id’,1)->get(); But it is not working because whereHas returnscollection, What I can do ??? Please give advise. Sourc..

Read more

i’m trying to get All RequestStates Where DepartMent_id ‘s equals with my department_id But before returning the result, it should be checked that the User_Id field doesn’t exists in Graduate Table this is my code : $request=RequestState::where(‘department_id’,auth()->user()->department_id)->get(); Relations: Request HasMany Request_State User Has One Graduate Tables : Reqeuest_STATE TABLE : USER TABLE Request Table: Graduate ..

Read more