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

2
votes
0answers
11 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
311 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
79 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
41 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
40 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 ...
1
vote
0answers
55 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
66 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
114 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 ...
0
votes
0answers
83 views

Possible improvements script that receives, formats and data persists

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 'repository' to manipulate data ...
3
votes
0answers
107 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
193 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
117 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
107 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, ...
3
votes
1answer
72 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
987 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
96 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
4k 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
137 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? ...
4
votes
2answers
2k 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
645 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
305 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
564 views

Simple application to experience encapsulation

Looking at the code, is this a proper example of encapsulation? additionalComputer.php (class) ...
5
votes
1answer
3k 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
737 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
177 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
326 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
886 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: ...