Questions tagged [laravel]

Laravel is a free, open-source web MVC framework for PHP.

Laravel is an open source PHP web application framework that is under the MIT license. Laravel includes a packaging system and ORM using an active record pattern and fluent query builder. The routing for the system allows for later changes to the routes to be propagated into existing links. Laravel also has restful controllers that provide another way to separate the logic behind GET and POST requests.

130 questions
13
votes
2 answers

Multi tenancy or multi instance?

I'm trying to build a web-based SaaS solution, and I hit a road where I'm not sure to use multi tenancy or multi instance. I will try to describe what I'm trying to achieve, and each approach advantages and disadvantages (my opinion, according to…
7
votes
1 answer

Service Design Pattern

I'm working with services and I found out there are at least 3 ways to use them inside controllers... Statically: Like helper, Text::uppercase('foo') Instancing it: $text = new Text(); $text->uppercase('foo'); Injecting with reflection through…
7
votes
1 answer

Unit testing Eloquent outside of Laravel

How can I unit test my Eloquent models when I'm using the ORM outside of Laravel? What I'm hoping to do it run tests on each model but somehow mock the database connection/query/builder(?) object. Below is something along the lines of what I'm…
Martyn
  • 795
  • 8
  • 21
6
votes
2 answers

Laravel Eloquent - Filtering results and eager loaded results

So here is the use case: You have users and they have many addresses. Say you want to filter and eager load on addresses (say...only US addresses). In order to do so you have to filter the eager load AND filter using whereHas so your result set is…
Bill Garrison
  • 249
  • 1
  • 5
  • 13
6
votes
2 answers

Designing a ticketing system where the User and Administrator have similar but different functionality

I am designing a simple ticketing system in Laravel 4. The system will simply allow a User to create a ticket, and an Administrator to answer it. The User will be able to: View a list of his tickets. Create a new ticket. View the replies to one of…
Zsw
  • 163
  • 1
  • 8
5
votes
3 answers

Necessity of TDD in web application development

There are only two members in our development team and we started to work on a medium scale web application (Laravel). My question is about testing especially TDD, Do we really start to follow TDD strictly or start development without any test…
Jabaa
  • 159
  • 2
5
votes
0 answers

DDD directory structure for MVC app

As a means of learning and gaining some experience with domain-driven design, I'm restructuring/refactoring an old application written in PHP which utilizes the Laravel 5.1 framework. Below is a mock-up of a simplified structure I came up with to…
alaric
  • 159
  • 4
5
votes
3 answers

How to prevent multiple form submissions when user reloads the page

I'm currently working on a project which requires that we integration a 3rd party SOAP API to handle a number of basic CRUD type operations. Our current implementation allows us to leveraging the Laravel framework's form validation classes prior…
user2308097
  • 485
  • 8
  • 10
5
votes
3 answers

Should I use foreign keys in my database if I use laravel?

I'm creating a website with Laravel for the first time. I checked relationships documentation today and it seems that Laravel just uses simple SQL queries. class User extends Eloquent { public function phone() { return…
Andrius
  • 161
  • 1
  • 2
5
votes
1 answer

How does code produced on an open-source framework is affected by it's original license (MIT in this case)

I'm looking into building a new PHP commercial app for a client that will be hosted as a paid service and possibly resold to third parties with a non-compete clause. I've tested a few frameworks and chose Laravel which is licensed under the MIT…
Leg'harry
  • 53
  • 2
4
votes
1 answer

Is it good to pass variables through methods?

I am working on a team where my mates introduced the service & repository pattern. We work on Lumen micro framework. So from the controller, the call is passed to the service and then to the repository. We use controller injection. The service and…
ssi-anik
  • 149
  • 5
4
votes
1 answer

Best architecture for a Laravel app with a frontend (users) and backend (admins only)

I am building a website application using Laravel that will allow me to run gaming tournaments. The site will consist of two types of user, one being the 'admins' that can add/edit results, and the other will be 'users' who can basically view…
Zabs
  • 167
  • 1
  • 9
4
votes
1 answer

RESTful api and nested resources

Having built a RESTful API (using Laravel) for a project at work, I followed what seemed (from lots of reading) to be a the majority in terms of my approach to nested resources - by defining them in the…
C Ivemy
  • 59
  • 1
  • 7
4
votes
1 answer

How to handle method chaining and null return for Laravel models

If I am loading a model with Model::find($id) and the id is not found it returns null. This is fine except if I try to chain things. Model::find($id)->loadAttributes(); Load attributes is going to fail because it's not a method of null. The simple…
Matt
  • 185
  • 1
  • 8
4
votes
1 answer

Storing in MySQL relationships between different type of objects

I have an app that needs to attach objects of different types between them. For example: I have to add Lead type object to a Contact type object , a Contact to an Event and so on. Such relationship looks to me to be an undirected graph (If Car A is…
1
2 3
8 9