I am beginner in Laravel. I use in my project Laravel 8. I have this code: Controller Model Observer ServiceProvider I have 2 questions / problems: How can I disable following in the controller (index method)? I only need to record the moment when someone opens one record for editing, and does not list all the records in the list
Tag: laravel
DDD, problem with value objects and “new Domain()”
I have a question, I am migrating from MVC to hexagonal architecture and DDD architecture in a laravel project. I understand that a value object represents an attribute of table X but I have a problem, I have a table with 60 columns, would it have 60 value objects? That same table in the laravel controller has a join with
Laravel 8 eloquent query delete
How to delete the aircon in database when there is no any data. Order and Aircon are many to many relationship. Answer try whereDoesntHave Edit: You can also add new column aircons_count will old number of aircons for every order which will be faster than the above query and run the query like the following: Note: make sure to add
how to use Laravel 8 query builder like eloquent for searching
I’m developing a simple CRM with Laravel 8 that needs to search in query string. My query string would be look like: Now the problem is how can I search in controller? I want to do like this: I wonder why its not working and what is the standard way to do this. I’ve tried: but that didn’t work either.
My Laravel Code running slow because foreach, should i change my query to chunk? and how to optimize it?
The concept is simple that i want to sum some value that name total_hs from table analysis with same workingname. This code running so slow because of foreach if has alot of data. and for model like this Answer You want to return total value for every workingname, If I understand. You can replace your function with the new one
array_push replacing value instead of adding new value in array
I’m trying to make a cart system, which is I need to sum all total product. I’m thinking about saving the total to an array, so I can use array_sum it later. But somehow the array $total_cart[] only have last total, for example is if I have three product in my cart, the total saved in the array is only
Missing required parameters for [Route: photographers.edit] [URI: posts/edit/{photographers}]
I Get this error every time I create an edit button or even a button to view a particular post in my project. Here’s my route code: Here’s my edit function in the controller file : Here’s my view button route: I read a lot of previous posts on this issue but didn’t really help me. Answer sometimes the dependency
Laravel – simpliest elseif [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 months ago. Improve this question Hi, have i to do it more simple or its a normal practice? Answer Instead of using if-else, I would recommend
Return S3 private file as stream
I’m currently working on a route for a project that I need to get a specific file from S3, read its content, and return as a binary. I can’t just use the S3 file url, because it is private and it is intentional (we just don’t want the bucket files open). But the problem is, I want to stream it
join tables and see the count of categories in each category name in laravel 8
excuse me want to ask. I’m sorry in advance if my language is not neat I have a category table with colom -id (pk) -name -and others and i have a post table with colom -id (pk) -category_id(fk) and others I want to count the number of posts from each category along with the category name in laravel 8. this