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.

Filter by
Sorted by
Tagged with
1
vote
0answers
17 views

Providing JavaScript Configuration (Laravel config() style)

This may be better suited on Stackoverflow, in which case, please let me know and I will move it over... Background Consider the following file structure: ...
1
vote
0answers
19 views

How to splits blade files that contain javascript?

I have these scripts ...
3
votes
0answers
24 views

Divide / Split single file .php into clean clode parts

I wrote a page with Laravel to manage projects with Scrumpoker through blade syntax with controllers, models and Vue js . My Problem is that I wrote the actual Scrumpoker in a single file.php file ...
1
vote
0answers
20 views

How should I instantiate a class using composition with Laravel IOC container? [closed]

I have an Analytics class that performs some actions to compile analytics data. Here is that class: ...
2
votes
0answers
37 views

Laravel testing for compatibility between old and new password-hashing schemes

I currently have an event listener tied to Laravel's Attempting class. The listener is designed to rehash an old password to something newer. The current DB stores ...
2
votes
1answer
26 views

Laravel controller methods for registering businesses and stylists

I use the Laravel API and want make messy code cleaner. I have a form for registering business and businessOwner. And stylist who is working under this business registering from same function. And ...
1
vote
1answer
57 views

A method to get a document's path

I have a model called Document, in this I have a method that I use throughout my website to get the full path to the specific document: ...
1
vote
5answers
77 views

PHP function to obtain model_name from Namespace\To\ModelName

Would there be a more clear/efficient way to write ...
2
votes
0answers
34 views

A cleaner way to track model changes

The application I'm currently working on have two main user types, let's say user and reviewer. I need to create a functionality ...
3
votes
1answer
28 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
64 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
52 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
33 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
44 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
161 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
34 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
44 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
36 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
66 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
39 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
82 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
62 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
65 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
512 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
110 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
86 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
222 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
355 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
90 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
1k 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
175 views

Laravel UserController Design

...
4
votes
1answer
82 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
88 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

My implementation of repository pattern in Laravel 5.6

...
2
votes
1answer
64 views

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

I have such part of function: ...
3
votes
1answer
495 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
37 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
150 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
258 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
218 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
671 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: ...