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

learn more… | top users | synonyms

1
vote
1answer
27 views

Laravel user permission system

I wanted to create a simple and easy to use permissions system. The ones I've found on the Internet would need to attach every permission to a route manually (e.g. Entrust). My idea is to build a ...
1
vote
2answers
47 views

Multi-User Roles in Laravel

I am very new to Laravel. I am building a website where multiple users can have one or more roles. I have a users table and a user_roles table. Each ...
2
votes
1answer
50 views

Collection of $_POST data

I have a backend API that I'm sure can a refactor, but I'm not exactly sure how to avoid repetition between the store method and the ...
0
votes
0answers
18 views

Dynamic/Global Business Days Calculation

I have a problem in that I need a formula which calculates business days around the world. For example, in the UK we have 5 day weeks, but in the Middle East they have 6 day weeks. Also, perhaps we ...
1
vote
0answers
40 views

Passing standard data through serviceprovider

I am using Laravel 5, and to pass the users his favorites and permalink, I edited the AppServiceProvider. I was wondering if my solution is the most reasonable ...
1
vote
1answer
36 views

Laravel 4 search function

I am using this code in my controller and would like to know if this is good code to use or if I can write it better, or more compact, and so on. I am just trying to learn from this. It does work, so ...
0
votes
1answer
49 views

eCommerce web appliation

I am making an eCommerce web application using the Laravel 5 framework. I have created a Categories controller for the administrator and with the following actions ...
1
vote
1answer
52 views

URL link SEO and security using Laravel

I'm trying to figure out what the best way to do this is. I have a part on my website where people can search for a particular card based on multiple different factors. Like the name of the card, ...
1
vote
1answer
39 views

Laravel time-punching database structure

I am trying to build a database structure for a time punching system. What I'm trying to figure out is if what I have is the ideal structure, or if something else exists that I'm overlooking. I want ...
4
votes
1answer
100 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 ...
6
votes
1answer
216 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 ...
0
votes
0answers
56 views

My Users Controller

I was hoping someone could take a look at my users controller and give their feedback based one their opinions of what they think of my user's controller. As well as maybe give some ideas if any for ...
1
vote
1answer
81 views

Laravel photo uploader class

I'm trying to separate logic from the controller, so I created this Upload class. It is not a big class, just a class so that the controller doesn't know about the ...
1
vote
0answers
119 views

Image upload handling in Laravel

I'm trying to create a handler to set the profile picture for the user. Don't worry about the validation as I will clean that up, because that's for testing purposes. This is how far I went. I'm using ...
1
vote
0answers
46 views

Decoupling payment classes

I have several classes for payment handling, I separate these classes into directories like below. Actually I'm going to use it for Laravel project but to make it simple, maybe we can talk as if it's ...
3
votes
0answers
180 views

Laravel controller for a commenting system

Can someone review my Controller? I should follow these guidelines: Code should be written with MVC pattern and to use OOP. The code now works fine, but I need to improve it. Also, should I use ...
1
vote
0answers
114 views

Laravel routes.php optimization

My goals are: Have 2 main domains .com and .dev for production and local installations Have 2 main subdomains. One for the site and one of the application Site must be public and application always ...
1
vote
0answers
955 views

Laravel 5 Dependency Injecting a Repository into a controller, and depedency injecting an entity into repository

Overview:: I have a Restful API that pushes all /api/{version}/{Repository} into my ResourceV{1}Controller depending on the ...
3
votes
1answer
35 views

Formatting database results to be consumed as multiple tables by the view

In the code below, $rows is the result of database query. In the view that consumes this, I need to break the results into a separate table for each vendor. The below creates a structure that allows ...
2
votes
1answer
400 views

Controller for repository of members

I am still new to Laravel, just learned the Repository pattern. I tried to implement it on my project, here's the result: MemberController.php -- this one is a bit ...
2
votes
1answer
190 views

UnitTesting: Is this TestCase overkill?

Is this Test Case overkill? I am new to Unit Testing so I am learning and I'd love to hear your opinion about it. ...
3
votes
0answers
94 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 ...
1
vote
1answer
53 views

Object instantiation with multiple parameters

I'm trying to create a little block presenter for Laravel which displays blocks of content in certain positions. I have 2 classes, BlockFactory and ...
2
votes
1answer
307 views

Laravel controller for form validation skinny

I'm trying to make controllers skinny as possible. I use repositories for accessing the database and I use Services to do other stuff. In this case, I use it to insert a new post to the database. For ...
2
votes
0answers
137 views

Immediately send redirect response, preserving session data

This question is for Laravel 4 only, as the relevant parts are completely refactored in the upcoming Laravel 5. I have written an helper function for validation, so I only have to put this in ...
1
vote
1answer
497 views

Product page filter

I am still learning Laravel and I am in the process of creating a small shopping website. On the left hand side there are a series of filters that appear depending on what products have come back ...
1
vote
0answers
94 views

Script that receives and formats data

The code snippet below, receives data from a form, formats and inserts into the database. This code snippet is located in a controller and the insertion is done in a '...
3
votes
0answers
238 views

Laravel Testing: Is this testing too much of the inner workings?

So I'm using laravel for a project and have a InvoiceRepository and a InvoiceRepositoryTest and I have written the test first ...
1
vote
1answer
307 views

CRUD implementation using Laravel 4

I just started using Laravel 4. I read some tutorials on how to implement CRUD in Laravel, and I was able to develop a portion of it. What I am going to show you is more on Controller and Eloquent ...
0
votes
0answers
158 views

Laravel Pagination: a new one adapted from an old Dreamweaver extension

I'm new to Laravel and I'm trying to port the most important old-procedural-code snippets and libraries I collect in some years I missed a nice Pagination I had in an old Dreamweaver extension and I ...
3
votes
2answers
247 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, ...
4
votes
1answer
79 views

Returning JSON depending on the route_id

I have a controller that has a purpose of returning json depending on the route_id being passed from the route (Using laravel). There's a point in my code where I ...
4
votes
3answers
2k 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 ...
3
votes
1answer
106 views

Clean up / refactor this store() method

I'm new to Laravel and trying to figure out how I can reduce/refactor this store() call in my SessionController. Basically, the ...
0
votes
1answer
7k views

Optimizing Laravel Eloquent multiple joins

The following is working and readable SQL for Eloquent that I have created. The downside is that it looks more like a 1:1 with SQL and I don't think I'm using the full potential of Eloquent. I thought ...
5
votes
1answer
208 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? ...
5
votes
2answers
3k 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. ...
2
votes
1answer
925 views

Laravel - lots of dependency injection

I have the following UserServiceProvider and I'm wondering whether so much dependency injection is overkill: ...
2
votes
0answers
406 views

Social user login

This is my first Laravel package. It uses hybrid Auth package to authenticate users using their social network accounts. It can retrieve information to store in a local database. Its purpose is to ...
3
votes
1answer
990 views

Simple application to experience encapsulation

Looking at the code, is this a proper example of encapsulation? additionalComputer.php (class) ...
5
votes
1answer
4k 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: ...
3
votes
1answer
966 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. ...
2
votes
1answer
238 views

How do I reduce the if..else soup in this Controller function?

The processing is the same, but the response type differs based on whether it's an AJAX request or not. One way I can think of is to store all the response calls inside closure functions, and return ...
0
votes
1answer
561 views

DB Query within foreach

I'd like a general opinion on my piece of code (which does exactly what I want it to do). I feel like I'm using bad practices, like a DB query within a foreach ...
1
vote
1answer
1k views

Multi-page form attempt

I have just started playing around with L4 and would like to get some feedback on how I implemented a multi-page form Here are my routes: ...