Skip to main content

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
9 votes
2 answers
16k views

Laravel model and controller interaction

I want to know if I'm going about creating and calling two functions from my model to my controller in the simplest and cleanest way. Model: ...
Mitch's user avatar
  • 235
9 votes
1 answer
954 views

Document Merger using PhpDocX

I'm developing a document merger that utilizes an FTP site containing hundreds of documents. FTP Connection Function ...
Trojan404's user avatar
  • 818
9 votes
2 answers
722 views

Laravel Docker-Compose

I've created a repo for some Docker containers that work together with docker-compose to make a very easy and quick installation for Laravel including nginx, mariadb, and redis. Laravel is known for ...
Samuel Reid's user avatar
7 votes
2 answers
708 views

Phishing Project Assessment

Coming back for another look at my project after I've reworked a few of the key points made in my previous post here. So far, I've rewritten most of my code to address SQL Injection. I've created a ...
Trojan404's user avatar
  • 818
7 votes
2 answers
2k views

Simple inbox functionality using JavaScript and Ajax

I've been developing a simple CMS both for practical use and learning about Laravel, and I decided to implement a simple service that makes it possible for the administrators to send messages to one ...
Ashkan Pourghasem's user avatar
6 votes
1 answer
277 views

A Search Engine Class

I've built a Search Engine class for a website that permits to search companies in base of their locations and their categories (companies pay a plan to be found in the places that they will). In the ...
Claudio King's user avatar
6 votes
1 answer
320 views

Phishing application God class

This project is ultimately my senior thesis to graduate from college. It will end up being very long with several code reviews and redesigns. The next rubberduck perhaps? I've been working on a ...
Trojan404's user avatar
  • 818
6 votes
2 answers
1k views

Routing for a Laravel 5 e-commerce site

I am new here and learning Laravel 5 on my own. I want to get reviewed on the following routes.php code. My question are: Have I made any mistakes by doing this? If yes, then what could be the ...
Saiyan Prince's user avatar
6 votes
1 answer
488 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, ...
Captain Hypertext's user avatar
6 votes
1 answer
193 views

Controller to manage athletes

I would appreciate if you could give me some advice about the code below. I am a student learning PHP programming and programming fundamentals. I have learned a lot from Stack Overflow but there are ...
Kalpa Perera's user avatar
6 votes
1 answer
473 views

Instagram-like news feed display

I am writing an application that shows a news feed, much like Instagram. For this, I have a function in the model to select the feeds as shown in the code. For some reason, this runs quite slow and I ...
user3057156's user avatar
6 votes
1 answer
2k views

Controller for handling user registration

I spent a lot of time doing Go Horse Extreme programming, but now I want to be a better person. How can I make this method smaller, better, more OOP? ...
Bruno Rodrigues's user avatar
5 votes
2 answers
477 views

Optimization of a Laravel controller that passes data and views

I am trying to build a website that shows events. And I use the following controller. Please note that the urls ($view and ...
user avatar
5 votes
1 answer
2k views

Setting default of <options> in Laravel with PHP Match

I have a filter component that lets a user filter for events on a website. The user needs to see which category is currently selected in the filter. For this there is a URL with parameters. e.g. ...
user avatar
5 votes
2 answers
267 views

Queries to get unpaid and unpaid invoices

Here is my code: ...
zecaluis's user avatar
5 votes
2 answers
7k views

Laravel - Repository and Entity patterns

I've spent quite a bit of time studying the repository and entity patterns and this is what I came up with. I would appreciate it if you could post suggestions and critique. ...
Onion's user avatar
  • 235
5 votes
1 answer
790 views

Update specific model attributes from a request

Background This is for an API and I'd like to use this Upsert action to take data from a request and only update the requested fields. I.e. These are partial updates and I will not update every field ...
Taintedmedialtd's user avatar
5 votes
2 answers
590 views

Crawling thesaurus for a synonym

I have just finished core functionality for Tehsaurux. It crawls three thesauruses and will find a random synonym for you. It works with PHP agnostic and Scrapy for Python. I think the two main files -...
Naltroc's user avatar
  • 151
5 votes
1 answer
1k views

User Avatar upload

I have been looking at some coding videos on Laracasts and the focus seems to be very readable code and keeping the controller clean. How can I clean this up? This code takes an uploaded user avatar, ...
Jeffrey's user avatar
  • 181
5 votes
2 answers
1k views

Implementing Laravel old data in Vuejs

Users input their pin-code which is checked against the database and returned with the locality, district and state associated with that pin-code. Multiple localities may be returned so the options ...
Arjun's user avatar
  • 171
5 votes
1 answer
191 views

Email Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
Trojan404's user avatar
  • 818
5 votes
1 answer
1k views

Eloquent methods to calculate the average rent of apartments

I am working on a Laravel 5.1 website where I am counting the average rent of apartments in a specific area. Besides of that I want to get the average rent by amount of rooms in the apartment. The ...
Jimmie Johansson's user avatar
5 votes
1 answer
236 views

Plotting a graph of survey answers in Laravel

I'm using PHP (Laravel) to iterate over the survey_answers table and build datasets which I can show in a graph. I'm just wondering if this is the way to go. ...
Miguel Stevens's user avatar
5 votes
1 answer
291 views

Let users create custom blade templates

Problem: I need to let my web-app users create their own blade layouts. The content shall change based on what is in the database, hence their layouts should become dynamic in nature. With only the ...
Huzaib Shafi's user avatar
5 votes
1 answer
2k views

Laravel Scope get request data/param

I want to pass the param from the request on the scope method in the model and serve it as json to be rendered by select2. Which is better? 1. Pass request from the controller like this controller: <...
Muhammad Dyas Yaskur's user avatar
5 votes
1 answer
2k 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 ...
Jesse Orange's user avatar
5 votes
1 answer
173 views

Reimplementation of Laravel's config system

I am trying to create a config class identical to Laravel's but wanted to do it myself, to test my knowledge on the PHP language, can anyone help me improve it? Each config file is located in the /...
James Adolf's user avatar
5 votes
1 answer
881 views

Laravel Pagination with haversine formula in it

I'm using the haversine formula to count distance from selected post-code to desired destination. I have the following scope in ...
rkd.me's user avatar
  • 96
5 votes
1 answer
709 views

Laravel - Authentication Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
Trojan404's user avatar
  • 818
4 votes
3 answers
5k views

Controller method - Ajax request

I'm quite new to Laravel, and I'm not sure what am I doing is the best practice. I'd like to return JSON if the request is Ajax, or return a view otherwise. This is the way I made it, and it works ...
Angel M.'s user avatar
  • 145
4 votes
2 answers
460 views

Phishing Project Sending Email Reworked

@Pimgd gave some good feedback on the previous post. I've made the changes that I think best suit my application and am looking to see what people think of this implementation. PhishingController <...
Trojan404's user avatar
  • 818
4 votes
2 answers
5k views

Laravel 8 registration and login with user profiles

I am working on a Laravel application (Github repo) that requires user registration and login. After registration, the users can change their registration details (except password, for which there is ...
Razvan Zamfir's user avatar
4 votes
1 answer
148 views

Laravel controller method that searches jobs using variable criteria

I have custom code where I check request params for existing and make query to database with model ...
Andreas Hunter's user avatar
4 votes
1 answer
394 views

Laravel UserController Design

...
garjoka madafa's user avatar
4 votes
1 answer
654 views

eCommerce project using the Repository pattern

I am currently working on an eCommerce project in Laravel 5.1. I have implemented Repository Pattern by learning from this site only for 1 model, namely, ...
Saiyan Prince's user avatar
4 votes
1 answer
1k views

Laravel 4 clean code review of users controller and model, trying to maintain MVC structure

I'd like you to review my attempt at creating an authorization class and let me know if there is re-factoring to be done and/or how I can make the code cleaner and abide by the MVC structure. ...
Mitch's user avatar
  • 235
4 votes
2 answers
7k 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: ...
Adam's user avatar
  • 345
4 votes
2 answers
248 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 ...
Jane Edwards's user avatar
4 votes
2 answers
98 views

Phishing Project Sending Email with Configuration Classes

As suggested by @MikeBrant in the previous question, I've added in two configuration classes to simplify and more broadly organize the objects required to send my mail messages. This also removes the ...
Trojan404's user avatar
  • 818
4 votes
2 answers
6k views

Effective usage of multiple joins in Eloquent dependent on variable

I have an Eloquent model that has multiple types of joins that is used to filter out different request to grab the data of movies e.g.: Actors, ...
azngunit81's user avatar
  • 1,210
4 votes
2 answers
127 views

Filtering from a file to show information

I want to get my code cleanner and more efficient. This code gets variables form a PHP file and filters it to show the selected user name, all available usergroups on a list box and the groups he is ...
davidsi02's user avatar
  • 231
4 votes
1 answer
50 views

Protecting Vue page based on the API response

If the user/visitor has access to the API route, then the status code will 200, else 401. I know that I can user Vue navigation guards, but I will need to use Vuex. This way is much simpler and faster,...
Marvix's user avatar
  • 91
4 votes
2 answers
2k views

Map associative array to another array php

I have an associative array of the states of some country, and the states names are the keys: ...
sc0rp10n.my7h's user avatar
4 votes
2 answers
2k 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 ...
derrickrozay's user avatar
4 votes
1 answer
2k 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 ...
begoing's user avatar
  • 49
4 votes
1 answer
159 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 ...
Khawar Raza's user avatar
4 votes
1 answer
1k 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 ...
Tom Johnson's user avatar
4 votes
2 answers
646 views

Laravel 5.4: Authentication System

I have recently coded my own authentication system and wondered if there was any way I could make it better? I coded it with Laravel 5.4. getView is called on ...
Josh Hallow's user avatar
  • 1,345
4 votes
1 answer
3k views

Exception Handler on a Switch

I am working on rewriting an application in Laravel 5.1. I am new to the exception handling technique introduced in 5.0. I have overlooked taking advantage of throwing/catching exceptions frequently ...
Tom Ford's user avatar
4 votes
1 answer
116 views

Single end point REST API

I want to ask question about a better way for implementing single endpoint REST. I want to build a rest API but I want it to only have single endpoint like: graphql,...
ucup's user avatar
  • 143

1
2 3 4 5 6