Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
1answer
49 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
23 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
49 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
175 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
votes
1answer
30 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
52 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
40 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
62 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
52 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
54 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 ...
0
votes
1answer
90 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 <...
0
votes
0answers
119 views

Querying 2 or more tables with joins or eloquent relations

I have few tables that store the details of educational content within a school. Tables' descriptions viz. A grades table stores all grades, subject table stores all subjects, ...
4
votes
1answer
131 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
51 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
72 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
802 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
137 views

Laravel UserController Design

...
4
votes
1answer
76 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
82 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
60 views

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

I have such part of function: ...
3
votes
1answer
241 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
31 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
123 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
140 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
993 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
164 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
48 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
437 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
2k 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
161 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
88 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 ...
3
votes
0answers
319 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
307 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
575 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
56 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
170 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
227 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
78 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 ...
-1
votes
0answers
865 views

Laravel and jQuery File Upload

I'm using Laravel 5.5 and the agnostic gargron/fileupload library, a sort of PHP wrapper for jQuery File Upload (that I'm using in the Basic Plus UI flavour). The ...
0
votes
3answers
71 views

Get users that are presidents and compute their name

I have a user table like this id | firstname | surname | title 1 | Bob | Batman | Dr. 2 | Alice | Grimley | Prof. 3 | Clara | Caprio | In ...
0
votes
1answer
466 views

Compare two tables and arrange the values in a new array

I have t things working with this current setup: ...
1
vote
2answers
552 views

Array_Swap function in PHP

In PHP/Laravel I have the following function. Can you please review my approach? ...
2
votes
1answer
270 views

Laravel routes/controller

I'm a clean guy when I code and I don't like typing the same thing over and over again, so I will try to be simple. In my Laravel project I have two routes for every major page on the website, for ...
3
votes
0answers
321 views

PHPUnit testing my custom helper Facade classes in Laravel 5.5

I have been reading up on TDD and it's something I genuinely want to learn and be good at. This is something I haven't been doing as a developer and I thought it's about time I get into it. These are ...
1
vote
2answers
159 views

Laravel Middleware

I've got a middleware that all my routes are grouped by, I'm doing a lot in 1 middleware. I was wondering if anyone could tell me how to better structure my Laravel application. I couldn't find any ...
2
votes
0answers
20 views

Login Controller follow-up

I was wondering if this class can be refactored to be more efficient. I've taken tips from other people who have already helped me refactor it a fair amount, but I was wondering if there was any last ...
2
votes
1answer
613 views

Laravel LoginController

I have a LoginController in Laravel, but I think it could use some improving, can anyone tell me where I am going wrong? It just seems overall a bit messy, but I can't think of a logical way to ...
0
votes
0answers
717 views

Laravel model class that creates dynamic queries

I am learning Laravel and I created a dynamic query of sorts using OOP. Just now I've come across this article: here In the comment section it stated that when creating a connection with the database ...