9
votes
Necessity of TDD in web application development
If you are starting a greenfield project I would urge to start automated testing from the start. Doing everything TDD might be a challenge if the team has low experience with TDD. Still setting a ...
9
votes
Should on each test create and nuke a testing database?
Tests should be independent of each other and reproduceble.
This can be done with
complete database setup for every test as you described
or with a predefined database-content where a database-...
8
votes
Using multiple languages
The usual way to support multiple languages is to find some way for the two to talk to each other. This is very common in the web world; you might have a ROR site talking to an Android application. ...
8
votes
Multi tenancy or multi instance?
I am asking myself the exact same question at the moment.
I am leaning towards the multi-instance single tenancy solution but have not taken a definitive decision yet. Let me share some of my ...
8
votes
Accepted
Service Design Pattern
Sorry for the C# syntax, I'm not a PHP dev. But the core of the answer is language-agnostic, and I hope the syntax is readable enough for you to understand the focus of the examples.
You've actually ...
7
votes
Should I use foreign keys in my database if I use laravel?
The data belongs to the organization, not the application. While right now you're using Laravel exclusively, in the future there might be several applications interacting with the database.
I'm ...
7
votes
Should I use foreign keys in my database if I use laravel?
Foreign keys in your database enables data integrity, as you can't delete a parent row if there is a child row in another table.
While you can rely on the framework to handle data for you, the ...
6
votes
Accepted
Consuming REST services: client or server
As is often the case, it depends
With a pure JS framework
you push a lot of processing to the clients. That means your webserver for the client application will only be serving static files that can ...
6
votes
Accepted
Laravel Eloquent - Filtering results and eager loaded results
You're confusing whereHas and with.
The with method will let you load the relationship only if the query returns true.
The whereHas method will let you get only the models which have the relationship ...
5
votes
Accepted
Laravel 5.2 - Better to create a Service Provider or Helper class or otherwise?
It is all a bit of semantics.
A service would be a helper class, or in a sense a helper class would be a service.
In terms of Laravel. Creating a service (which is a specific thing) would help code ...
5
votes
Push notification from web application to my mobile app
There is no need to reinvent the wheel and there are plenty of solutions out there that makes pushing notifications to mobile devices easier.
I personally would recommend Firebase Cloud Messaging by ...
4
votes
Multi tenancy or multi instance?
Supporting both options is possible also (a pool of tenants across multiple instances).
I favor multi-instance cause of the natural isolation. Each customer's instance runs in it's own processes and ...
4
votes
Unit testing Eloquent outside of Laravel
You probably want to test a class that is using an eloquent model rather than the model itself.
To create an in memory database for eloquent to query against in your test you want to do create a data ...
4
votes
Accepted
RESTful api and nested resources
If you are designing L3 maturity API (HATEOAS) [1], clients do not build or remember URLs. The best approach in this case is to have multiple mappings to support both scenarios: fetching by navigation ...
4
votes
Dependency Injection via Constructor vs Setter
I think that your Foo class should not depend on a Personable instance. Your Foo class probably has a number of methods that you can call to make it perform some actions using the Personable object, ...
4
votes
Is it bad practice to have lots of Models Views and Controllers?
I would not fault you for having three different controllers; there is absolutely nothing wrong with that.
However, if you are feeling the need put each comment type in its own controller, there is a ...
4
votes
Accepted
TDD workflow with integration testing
It can be a bit overwhelming trying to come up with the right balance for your project. I'd like to help you with a framework of how to put it all in place.
It starts with the customer
Your product ...
4
votes
Is this a 'proper' use of a trait in PHP?
Far from being an expert, but I had the same question in mind for a while as well. This is what I have gathered.
The generic (across languages) definition does emphasize that a trait can extend the ...
4
votes
Accepted
Data is in database or get from API, where should API request code goes?
In my opinion, you should add another abstract layer (for example, a repository) between the model and the client using it. I think it's better if we keep the model clean from infrastructure related ...
4
votes
Placing business logic on a not so small/big project
We’ve learned over the years that most small projects grow over time. What starts as simple CRUD applications evolve into business critical systems and complexity increases exponentially. Sooner or ...
3
votes
HTTP Query String vs URL Parameter for referral codes
This form
www.example.com/invite/123
is preferable when your URL refers to something concrete and specific, like a business entity, transaction or document. The word "invite" typically refers to a ...
3
votes
Using multiple languages
One way is to explore micro-services.
In this case, you can have part of your application written in, for instance, PHP, and other part of the application written in RoR. These two applications ...
3
votes
Advantages and disadvantages of building web app purely with microservices and hybrid with web framework
Frameworks have come a long way. They're very powerful and get amazing things done. They've also become so ingrained into the languages they work with that employers have to mention them when ...
3
votes
Accepted
Designing a ticketing system where the User and Administrator have similar but different functionality
Write two different UIs.
Really. I work on exactly such a system every day, and the user experience for your User and Administrator personae are completely different. They're different because the ...
3
votes
How to prevent multiple form submissions when user reloads the page
I have answered this question on StackOverflow as well - I place my answer here for easy reference...
The PRG pattern alone will not prevent this, as the P action in it takes time (which is usually ...
3
votes
Accepted
How to improve version control on database structure when migrations take long?
Your version control strategy seems fine, you just need a performance optimization for your migrations. You wrote
Soon we find that some old project takes long time in running the migration file
...
3
votes
Accepted
Queue how to preserve requests?
I found the problem.
Yes I must save the Eloquent model (if using a eloquent model) injected in JOB.
Reading better the documentation says:
"If your queued job accepts an Eloquent model in its ...
3
votes
Accepted
Best architecture for a Laravel app with a frontend (users) and backend (admins only)
It's far more common to have one app and one users table. Look at any CMS out there (Wordpress, Joomla, forum software) - admins are always just regular users with additional privileges.
In Laravel ...
3
votes
Necessity of TDD in web application development
Strict Test Driven Development requires the test for the next bit of code to be written before the tested code is written. In this way, the attempt to use the API positively influences the development ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
laravel × 128php × 71
mvc × 16
architecture × 11
design-patterns × 10
api × 10
mysql × 9
database × 8
rest × 8
object-oriented × 7
design × 6
unit-testing × 6
javascript × 5
database-design × 5
api-design × 4
dependency-injection × 4
orm × 4
programming-practices × 3
web-development × 3
testing × 3
git × 3
web-applications × 3
tdd × 3
solid × 3
web-api × 3