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
14 views
Extend the Laravel Eloquent model in order to easier implement CRUD REST for my routes
By extending the Model and using this inside my routefiles, I can easily call these functions inside the corresponding HTTP ...
3
votes
3answers
62 views
Device limitation rule for user
I've created a simple application for mobile users, they can login using provided API but must have limitation on the devices, so the requirement is simple :
User cannot login using more than 2 ...
1
vote
3answers
66 views
External variable in callback for chunk()
I am trying to implement search in Laravel. I want to search on models. Since there can be many records in the database, I am trying the chunk function.
...
0
votes
0answers
23 views
Maintainability with lots of lookups, checks and inserts
I have the following method in a Controller in Laravel 5.3.
The method is supposed to be in two other controllers and all three Controller methods will receive the needed arguments in different ways.
...
0
votes
2answers
64 views
Laravel Wordpress REST API Controller
For a Laravel project I needed to show latest three blog posts on the homepage.
The blog was made with Wordpress and after some research I found a cool plugin called REST API that allows to get a json ...
3
votes
0answers
60 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 ...
8
votes
1answer
92 views
Document Merger using PhpDocX
I'm developing a document merger that utilizes an FTP site containing hundreds of documents.
FTP Connection Function
...
0
votes
1answer
68 views
Repository code in Laravel
I am practicing to code in the right way and make it testable. Please review this code and tell me anything bad practices of it.
Entity:
...
2
votes
1answer
86 views
Laravel generate category list from product results
I have product results with some filter, and the one is category. I'll get the category list from product results. the model category and products is one to many relationship.
This is the search ...
1
vote
1answer
62 views
Laravel controller to update appointment requests
My question/refactor is similar to what is found here:
Laravel controller for form validation skinny
However, I feel that the answer is for 5.0 and not 5.2. This question does not pertain only to one ...
1
vote
1answer
38 views
Phishing Project - Refactor Using Models
After receiving some good feedback on the previous question, I've refactored my database and have begun to refactor the associated code. As a result of implementing models for all tables in the ...
2
votes
1answer
51 views
Phishing Project Refactoring to Use a User Object
Continuing on my quest to make sure that my application is developed strong, securely, and efficiently, I've updated my code as suggested in the previous question.
To start, I've implemented a ...
0
votes
0answers
23 views
Decouple resource that only lists items owned by logged user
Both methods works just fine, but I would like people's opinion on whether I'm facing this the wrong way. JWTAuth returns an ...
0
votes
0answers
34 views
Moving the HTTP and Request to controllers and Routes
I am new to Laravel framework and I made a project application which is working fine but someone said
You should avoid accessing the Request object in your views.
here is the full application ...
1
vote
1answer
57 views
Phishing Project UserIterator Implementation
As I stated in an answer comment on my previous question, the UserIterator has a much larger footprint than I think most people realize. This question is here to further explain the project, the ...
4
votes
0answers
63 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 ...
4
votes
2answers
69 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 ...
4
votes
2answers
210 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
<...
2
votes
1answer
69 views
Phishing Project Sending Email Assessment
I've gotten a lot of feedback about my tracking system already. So now I'm changing gears and looking at my email generation system. I have a class called Email which manages the sending of emails, ...
1
vote
1answer
53 views
Phishing Project Webbug Implementation
Here comes the next round. I've implemented some of the suggestions from the previous review. That being said, though, there are a few things that I have on the horizons but haven't yet put in that ...
7
votes
2answers
131 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 ...
3
votes
1answer
58 views
Phishing Project Error Logging
Moving on to the next steps! Previous review was here. The idea here was to implement suggestions made by @hd/@Pimgd and then implement an effective way of tracking and logging results when an ...
7
votes
2answers
676 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 ...
0
votes
0answers
154 views
Laravel Unit Test for API
I'm currently building an API with Laravel 5 and I've written some unit (or integrated?) tests for it. I've been reading a little about unit test and how to not overdo it and I would like some input ...
0
votes
1answer
33 views
Single endpoint for ingoing mail with multiple purposes
The following code is not one of my proud moments. In its initial state, I had only a single purpose, but know I'm up to three purposes and I don't know if it would stop there.
I'm using mailin.io to ...
6
votes
1answer
217 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 ...
2
votes
1answer
36 views
Database query with Eloquent
I have got two tables articles and tags in the database. My goal was to retrieve all fields from articles table and one category field from tags table with Eloquent. I couldn't do this so instead I ...
1
vote
1answer
142 views
0
votes
2answers
68 views
Logging in with multiple types of info
I'm trying to let users log in with multiple columns (e.g. ID, email, phone). If one fails, it checks the next column.
I would like to minimise my if and ...
0
votes
1answer
73 views
Laravel dropdown list without empty values
I'm creating dropdown list from all possible cities in database, all cities are distincted.
...
0
votes
1answer
130 views
Laravel transactions with a database
I'm really concerned about my transaction with a database and my code structure. I have created more methods to insert, update, delete data to the database but sometimes some of them will break or ...
6
votes
1answer
101 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 ...
1
vote
1answer
69 views
How to optimize Method Visibility and code structures for better performance?
I'm creating an application to get data cross domain all the line of code seem work as well but I'm not much understand about performance with my code process with the real server and real action ...
-1
votes
1answer
64 views
Authorizing users for POST requests
I've to authorize some users to do POST requests from their CMSs in order to create a new resource on my database. I've to send a JSON response containing the status of the response (successful or not)...
0
votes
1answer
42 views
Repeating HTML, minus a few class and array key differences
I feel like this code is pretty sloppy and can be accomplished in a foreach loop. But it's a bit complex using a multi-dimensional array.
Can this be cleaner? You ...
3
votes
1answer
198 views
Accessing Data inside Presentation Layer from API: Laravel 5.2.27
I wrote the code to fetch the JSON Data. For that I tried to do this in 2 projects.
First Laravel project which has API code for database interaction only.
Sample code in API controller
<...
2
votes
1answer
795 views
Profile picture upload method in Laravel 5.2
I am a Laravel newbie so please forgive me for my code... I have a method, in a Laravel controller, that updates the current logged user profile (...
0
votes
2answers
135 views
Dynamic reports to Laravel view into HTML table
The getDynamicTeacherCount function is generating number-based reports from the table that I have in database and the ...
0
votes
1answer
591 views
Laravel bulk insert optimization
I'm currently using a make shift INSERT on DUPLICATE UPDATE function that relies on a DB raw query from eloquent. I'm looking to improve the quality of the code and the speed. Please take a look
<...
4
votes
1answer
61 views
Generating statistical reports
I want to generate statistical reports and I have many different where clauses so the function became long. I did much refactoring, but it is not enough. Can ...
3
votes
1answer
210 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 ...
1
vote
0answers
52 views
Proper PHP array walkthrough
I am working on a ticket reserving system right now. The users can reserve seats in a cinema for every movie. Whilst my code works, it is not the fastest. When a customer buys ticket (seat(s)) I check ...
1
vote
1answer
79 views
Method on Laravel model to find courses related to a course
I have a Laravel project that has courses. I want to take the related courses from one.
Should I create the method in the model (the php class) or in the controller?
Currently I have this code in ...
1
vote
0answers
44 views
Use of HTML (view) in a constructor
I have this constructor (from a Service) where I'm setting a few variables, but two of them include HTML. Is there a best way to set those values, maybe by creating a method in the class to set them?
...
0
votes
1answer
133 views
Laravel 5 controller to list appointments by date range and by label
I am starting to get into OOP using PHP and MVC. I just want to know if this code is good practice. Is this how I should be using my controller and model, in its simplest form?
AppointmentsController:...
0
votes
1answer
47 views
Compare 2 Different database Table
I have php function that compares two different database table. Any suggestion on improving it.
...
4
votes
2answers
223 views
4 database queries, multiple loops in loops, slow processing time
The octoberCMS(based on laravel) controller below is what I use to select the lowest price in 4 pricelists in the given daterange.
Prices can vary and it's not guaranteed that the more expensive ...
1
vote
1answer
38 views
Calculating a quality score of something based on attributes
I'm willing to have a way to calculate a quality score of an object; in this case an addressbook contact.
I believe there are way better approaches to do this and I'd like to hear your references.
...
2
votes
1answer
119 views
Class that generates records after performing business logic
I wrote a small class that does a database lookup and it generates a collection/Array. The Collection is resorted based on values returned from the database. Finally, the records can be retrieved ...
1
vote
1answer
50 views
Handle data insertion after validation
I have an application that has a form. Validation and data insertion works fine. However, it bulks out my controller. I've always been told skinny controllers.
For example:
...