Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [laravel]

Laravel is an open-source PHP web development framework created by Taylor Otwell. Laravel helps you create applications using simple, expressive syntax.

1
vote
0answers
10 views

List products based on slug and sidebar filters

This method shows the list of manufacturers' offered products based on the slug and sidebar filters. Most of the time I have to write the same query with only some changes: you can say I am repeating ...
0
votes
2answers
54 views

Asynchronous query to load products from laravel controller

The following code works fine. When a user clicks on an element, an AJAX request is made, which will return the query result. The results are being displayed in a view. I read many articles where ...
1
vote
1answer
47 views

Laravel executing 100 queries on page load?

Debugged my page load (was taking 4s...) and I was running 94 queries. 30 of them were the same. I've refactored a little by caching results, but how can I further refactor this class? The project is ...
1
vote
0answers
24 views

PHP / Laravel - Using Python to image manipulation

I have a simple job class in Laravel, that: Get all the images in a folder /original Perform some image manipulation on each image Save each image in a new folder ...
2
votes
0answers
41 views

PHP - Transforming text content according to rules then persisting to database

I have a web application where my users can upload text documents and emails into what I call Streams. A stream is like a "stack", that holds all emails / documents. My users can then add ...
1
vote
1answer
135 views

PHP Laravel - Improving and refactoring code to Reduce Queries

Improve Request to Reduce Queries I have a web application, where users can upload Documents or Emails, to what I call a Strema. The users can then define document fields email fields to the stream, ...
1
vote
0answers
31 views

Handling Multiple Asynchronous Events

I have a web application where users can uploads image documents. Now, after a new document is uploaded into the system, it should: 1) Be optimized. (OCR) 2) Perform various rules on the OCR output....
1
vote
0answers
43 views

updatePositions() Laravel controller method

I have been trying to implement good 'OOP' and coding standards, but I always end up with bloated controllers. How could I clean this controller method? ...
1
vote
0answers
33 views

A PHP Controller, which feels to 'array-like', in Laravel

This is a controller, which receives the validated input from a http request, then finds the assorted model and for each translation key in the received data, it will add it to the model. ...
2
votes
1answer
64 views

My code get data from database using AJAX and return to view

My code get data from database using AJAX the problem is i want to filter data by month year and quarter and the code that does that is: ...
2
votes
0answers
37 views

PHP - Saving inbound email and its attachment

I have below code, which is basically handling inbound emails in my application, save the actual email content (text + attachments) to my database, and further save the actual attachment file on my ...
1
vote
1answer
77 views

Laravel show and update currency from rest api

I need: Daily save new exchange rates from the REST API in the database. Return the current exchange rate for a given currency, the whole table for a given day, the exchange rate for a given currency ...
0
votes
0answers
35 views

Laravel working with dynamic start and end dates to grab some data

So, to start off, the below code does work, but it feels like a newbie solution to me, and if I ever need to come back to this code, I will have no idea what I was thinking. I have a table called <...
1
vote
0answers
64 views

Laravel Controller function to return view based on user permission

I have one route that switches the routes based on the permission the user has. Here is a little example: ...
0
votes
2answers
356 views

Laravel: Export customer record as CSV

Using Laravel, I need to export some value from the DB in a CSV and then upload the CSV via sFTP or return it in a Response. I'm trying to be use S.O.L.I.D. principles but with this scenario, I'm not ...
1
vote
1answer
42 views

Laravel function to add a supplier, and associated addresses and contacts

I have a function addSupplier() that adds a supplier. Each supplier has multiple addresses and each address has multiple contacts. ...
0
votes
1answer
57 views

How I can short my code when request have many parameters

Brief: I've create simple filter in my laravel project. I'll send parameters with ajax request. Code: ...
1
vote
1answer
43 views

Showing data for a chat with another user

I have a get route to show the data for a chat with another user. If an existing chat exists I want to return that, otherwise create a new chat and return it. ...
1
vote
1answer
93 views

Laravel image upload

I'm new to the filesystem from Laravel, but I need an upload script that allows users to upload images to my server. However, i'm concerned about securety, so I thought why not ask for advice, because ...
2
votes
0answers
56 views

Search query to find articles on website with certain tags

I have the following search query to find pages on my website where I'd like to make as much as possible use of existing functionalities to determine relationship names and to hardcore the least as ...
2
votes
0answers
75 views

SQL/PHP Laravel - Looping through records to find relationships

I have two tables in my database, which contains a big list of organisations. They are called orgs_main and orgs_sub. This is ...
2
votes
1answer
169 views

Retrive relation on a polymorphic model

I have a Game model that is "static". Containing game information and such, and users can comment on all games. Games model <...
5
votes
1answer
264 views

File uploads in Laravel - Single and multiple

I have been reading up on file uploads in Laravel, reading through the documentation and looking at best practices. In my application, I have two instances: an upload area for single files, and an ...
2
votes
1answer
53 views

php Laravel - given a certain argument, call different function

I am building a simple calendar with recurring events. CalendarEvent.php id start_date CalendarRecurringPattern.php ...
0
votes
1answer
81 views

Cross-platform MySQL database backup using mysqldump

In a Laravel (PHP framework) project, we implemented a backup feature - backing up user-generated files and database tables. What we've searched so far, the best solution in backing up mysql database ...
3
votes
0answers
947 views

Full text search for multiple words using Laravel and MySQL

I'm using Laravel 5.6 and MySQL. I need to search multiple columns for a single word or multiple words (e.g., "camhandle", "cam handle"). The way I was originally doing it was just using ...
4
votes
1answer
159 views

Laravel UserController Design

...
4
votes
1answer
81 views

Users adding each other in Laravel

I'm looking for a code review for the following system that I created. It allows a landlord, to add a tenant to start a tenancy. It has added, accept, reject, and prohibits a tenant from adding ...
1
vote
1answer
86 views

Appending objects to an array based on a field

I am working with PHP5 (Laravel 5.1), and I couldn't optimize my function, which takes more 4 minutes turning, and fails in the end when I have a huge data (around 6500 rows, but working when i test ...
3
votes
0answers
1k views
2
votes
1answer
64 views

How optimize set of nested 'if' in one function?

I have such part of function: ...
3
votes
1answer
388 views

Laravel token middleware

I want to make my API unavailable to every client who doesn't have the token to access. This means the Android app will send a client as Android and ...
1
vote
0answers
31 views

Approach to a better flow for this context in terms of routes and controller methods? (avoid post request returning a view)

I have the context below, I dont know if the flow as it is its a correct approach in terms of controller methods and routes used because a post request is returning a view and it seems that its not a ...
1
vote
0answers
34 views

Laravel - Add different style to type of product

I'm working on a project where I have products. Each product can either be a theme, plugin or a plan. Now my idea was to add different styles to each of the types. For instance, Theme is red, Plugin ...
2
votes
1answer
143 views

Laravel Single Page Application Using Angular Js

I have created a Laravel Single Page Application using Angular Js 1.3.14 by learning tutorials in the websites. index.php: ...
1
vote
0answers
229 views

Using repository in a FormRequest in Laravel for custom business rule validation

This is my app/Http/Requests/Organisation/CreateOrganisationRequest.php ...
3
votes
1answer
1k views

Laravel voting system

I have written a voting class in Laravel. It uses the voting sites API to check if the user has voted today. A user is only allowed to vote once every day. All votes reset at midnight (i.e. 12:00 AM ...
2
votes
1answer
201 views

Laravel Dependency Injection : Perfomace Issue And Architecture Style

I have a TransportationController which uses six repositories. The repositories are injected to the controller via constructor and method. TransportationController.php ...
0
votes
1answer
49 views

Save all HTML field names in Controller - it is bad or not bad idea?

I have sample controller InboxController in my Inbox app. I want control with field name from my controller. If I will control with fields name from controller will ...
1
vote
3answers
590 views

Laravel controller to manage sent and received messages

I write small inboxing app in Laravel 5.5 for my wesite. In inbox app users can compose new message, read messages and delete messages. I have only one table in my database for inboxes. Structure of ...
1
vote
2answers
4k views

Get collection in blade and check if empty

If I want to display the addresses of a user in a blade file I do it like this: ...
1
vote
0answers
180 views

Replacing a substring in a table

I am using DB::table to search through a table that has a field called 'data' that has a substring ...
1
vote
0answers
109 views

Laravel Model and Controller code interacation

I am trying to understand if I placed the function in the correct place. If someone could review it and suggest what I am doing wrong or right it would be appreciated. Personally I think I placed the ...
2
votes
0answers
396 views

Laravel polymorphic usage

I am fairly new to Laravel and have implemented a many to many polymorphic relationship to a model where you have two tables that act as polymorphic references one is for content (text information ...
3
votes
0answers
377 views

Laravel Account models

This library is part of accounting system. Two major models are involved. For every transaction there is an entry in AccountTransaction model and corresponding 2 ...
1
vote
1answer
754 views

PHP OOP API Class

I want to do an API or contract in Laravel focus when one person wants a contract or credit, but honestly it's for a scholarship but the process it's similar when I got a credit from a bank. Honestly ...
2
votes
0answers
58 views

I wrote some import functions from APIs for a large scale application

I run a large scaled app much larger than I can handle or develop for, website grew out of control and currently has over 22000 users. We support importing from different APIs, each import is split ...
2
votes
3answers
235 views

Validation of Identification card fields (string and array)

I am validating two variables of an Identification card (cedula in the code). The first one is a string and the second is an array. My inputs are: 1- e.g. ...
1
vote
0answers
290 views

Laravel session handler for Phpbb sessions

Ok, so I am developing a Laravel 5.5 app that needs to interface with an existing phpBB forum. Specifically, if you log into the phpBB forum, you must also be logged into the Laravel app. Otherwise, ...
3
votes
0answers
80 views

PHP Laravel function to search for ads in MySQL

I am new to the Laravel framework. I have recently written a function which gets called through a route. The function is created for two purposes: Get ads from a particular city based on provided ...