Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [laravel]

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

2
votes
0answers
34 views

How to let users specify their own logical conditions (PHP / Laravel)

I am currently trying to create a web application, that saves inbound emails. I have figured out how to save the incoming emails into my database, and I have all the email information available (...
-5
votes
1answer
44 views

What beneficial software engineering principles are invoked when using Request Handlers instead of Controllers in context of MVC software pattern?

Request Handler - a controller with a single action. Controller - a class with one or more actions. What are the beneficial software engineering principles that are being utilized when using Request ...
-2
votes
1answer
32 views

over come HTTP client time out issue

I have an api end point which receives some parameters and process them returns a csv file. But the processing time may take more than 15 seconds. My server has build in timeout and some client ...
0
votes
1answer
59 views

Use same API for both website and other clients or not?

Lets say I am building some large application ( multi-page app ) using Laravel. And laravel will allow me to make an API and a website on the same application. Since the website and the API ...
1
vote
2answers
50 views

Integration Testing: Should a test check every validation?

I am somewhat new to writing tests and I want to build that habit into my workflow. So for example I might write a test that a user can create a blog post however I'm not sure on how to do that ...
0
votes
1answer
61 views

Database abstraction layer

I'm currently developing an SaaS application in PHP, with Laravel, using its own DB class. Let's pretend we've got 2 classes under 2 namespaces, plus Laravel's own DB - so Illuminate\Support\Facades\...
1
vote
1answer
89 views

Queuing emails in Laravel when using an api driver such as Mailgun?

In Laravel (for the record I'm using v5.6) there is an option to queue emails for background processing. I have a scheduled job to send out daily email alerts to users. Currently the job drops the ...
0
votes
1answer
72 views

Unit tests involving library functions and objects

I am making a project using the Laravel framework. I plan to create unit tests for my project. But I feel I don't really have an idea what to test because I mostly use library or framework functions. ...
0
votes
1answer
115 views

Is this a 'proper' use of a trait in PHP?

In Laravel 5.6 an Illuminate\Database\Eloquent\Relations\BelongsTo relation was given the ability to support default models. This allows a model that will be returned if the relationship is empty. ...
1
vote
1answer
46 views

Using the objects retrieved at the time of request validation

I hope the question title already answers the subject here. Lets say I have a number of ids that needs to be validated in a request. Example: request uri: [POST] /album/{album_id}/song Request ...
1
vote
1answer
161 views

Best practice API design for mobile app in sending multiple photos in one request?

I'm working on API design for a mobile app where the user can send one or more photos that will be stored in the database. Currently I have three routes, post photo/create which will send one photo ...
1
vote
0answers
258 views

Handling complex dynamic queries in Laravel 5

I am developing a project using Laravel. My workflow is: route directs to controller Controller calls eloquent models Eloquent models perform queries (tipically CRUD and find) Controller returns ...
-1
votes
1answer
78 views

Is Dependency Injection A Standard in PHP and Laravel?

Or in actuality, how to tell if a certain technique has became a standard in certain language / framework? As I understood from my readings so far, PHP supports DI in PSR-11 while Laravel uses it out ...
1
vote
2answers
335 views

Consume own API or make independant website

The PHP framework Laravel allows to make an API and a website on the same application. As both of them will communicate with the same database, I was asking myself what is better between consuming my ...
1
vote
0answers
55 views

Storing laravel API tokens from one API in another APIs env file

Last year my company started using Laravel to build APIs, and we created two separate repositories - one for a primary API and then a second for a secure API that would only accept requests from the ...
1
vote
2answers
420 views

TDD workflow with integration testing

I'm having troubles with using the right workflow with TDD. Some people say we should design before writing any code, some say we should make a test, make it pass, then refactor the code and that ...
0
votes
1answer
162 views

Is there a coding style for Blade templates?

Since when I used smarty I always tried to separate logic statements from html tags, so my approach to blade would be to write: template.blade.php <div> <div> @if ($something == true)...
1
vote
1answer
116 views

ORM for 600 tables

I am working on a huge application in php which contains almost 600 tables to work with, not to mention it requires complex joining for 10 or 15 tables together. i wanted to ask how much ORM is good ...
0
votes
2answers
676 views

Purpose of Closure Style in Laravel/PHP?

Many of Laravel's build-in framework libraries use closures as arguments. What is the primary purpose of this coding style? Is it just to gain more control over the configuration of the function, to ...
-1
votes
1answer
62 views

Laravel Service Providers count and DI

I understand how service prividers in Laravel works and how to use them. But I'm not sure about how to keep clean code, specificaly in count of method parameters. For example I have this route: Route:...
3
votes
1answer
496 views

Push notification from web application to my mobile app

I want to create a mobile app(iOS and Android) for business need, ex: the business is Health and Beauty. So I need a mobile app for sale some goods and service. However, I need push notification to ...
4
votes
1answer
76 views

Self aware Eloquent Model implements Strategy Pattern

I'd like to be able to have a (Eloquent) Model implement a class based upon a property of the model once it is created. I think this is the Strategy Pattern, but since I'm doing it from inside a Model ...
0
votes
1answer
775 views

Better alternative to having a html form with select input on every row in table

I have a web application (laravel) with a page which presents a large number of rows (financial transactions) in a HTML table. On each row I want to have a drop-down (select input) allowing the user ...
1
vote
1answer
128 views

Re-transforming data for API to consume

Having built a couple of moderately complex API's - both in Laravel - I appreciate the value of transforming data before sending it in a response. What I am struggling with is how this data should be ...
1
vote
1answer
336 views

How to manage when different user roles need to access to a same model in MVC

I'm learning how to work with the MVC pattern, using Laravel, but I have a question. This is an example case, there is a User model and the user can register by itself or an admin can create a new ...
0
votes
1answer
760 views

Using Laravel with DAO instead of Eloquent ORM

We have a complicated ERP software written in native PHP and our own micro-framework which uses big and complicated queries. We want to rewrite the application using an MVC framework (e.g. Laravel). ...
1
vote
2answers
501 views

Is it bad practice to have lots of Models Views and Controllers?

I'm designing a system at the moment using MVC (with Laravel, if that matters) and I'm trying to decide how best to architect a part of it. An an analogy, you could look at it like this: There's ...
2
votes
1answer
239 views

Architecting a DAM with MVC framework

I'm familiar with OOP and PHP, but I'm new to MVC frameworks. I'm currently using Laravel and have found it wonderful so far, but things have gotten trickier as I've progressed, and now I realise I ...
-1
votes
1answer
2k views

How to get machine client information from web application?

I am writing a ticket system in PHP(with Laravel) for about 350 users and around 200 machines. I know that already are good solid solutions available, but I'm doing some very useful projects to learn, ...
1
vote
1answer
204 views

Caching Layer in libraries: what's the most correct design?

Introduction Let's say that you have such design in your application: - application (laravel) - web scraper (used by application) - query builder (used by web scraper) The application is ...
2
votes
3answers
2k views

Dependency Injection via Constructor vs Setter

UPDATE 2017/04/19 Another view is using wrappers for late binding. Introduction I believe that objects should be immutable, so I only set properties via the constructor. In that case, the object ...
3
votes
0answers
311 views

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 ...
5
votes
3answers
430 views

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 ...
4
votes
1answer
2k views

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 ...
1
vote
1answer
5k views

How to integrate Laravel passport, oauth scopes and roles and permissions

I am developing SPA in angular and backend API in laravel 5.3. I have integrated Laravel Passport for oauth. I have to make roles and permissions implementation using views on tables from other ...
3
votes
1answer
2k views

How to perform data mining efficiently (in PHP)?

The moment of working on a system that gives you statistics based on some data gathered from the database has arrived in my company. How do you efficiently gather statistics from a database in such a ...
1
vote
0answers
63 views

Project Structure for intermediate level abstraction

This is really a question on higher level naming. We have an API directory for classes that deal directly without outside APIs, and contain all the code to consume a specific API. We call this lib ...
3
votes
1answer
2k views

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 ...
0
votes
2answers
159 views

When dealing with user-generated content, is it always better to just use a CMS like WordPress?

I am a web developer who is planning to build a web application which requires user-generated input, with that input presented somewhat like a blog in the sense that there is an article with pictures, ...
2
votes
2answers
824 views

Queue how to preserve requests?

I'm working with Laravel queues lately. I've all set up and running fine. What I see is that I perform a http request to my system, the controllers manage the request issuing a Model having request ...
2
votes
0answers
95 views

In browser form validation in laravel

In laravel 5 I describe models without specifying fields in model class. Some magic identifies which fields exist in database for this model. use Illuminate\Database\Eloquent\Model; class MyModel ...
2
votes
1answer
1k views

How to handle JWT expiry in Laravel 5.3?

I am developing a mobile application back-end service using Laravel 5.3. I am following REST API. Application having payment gateway integration and it needs more security. I followed JWT auth by ...
0
votes
1answer
55 views

REST API crossresource operations structure

I'm wondering what's best practice in next use case: I'have a view that displays data for 3 resources User, Company, and CompanyType (chosen in select, can be added dinamicaly so it's not enum). What ...
2
votes
1answer
3k views

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 ...
1
vote
1answer
54 views

Should I give users the ability to 'unreport' on a forum

(I really hope this is the appropriate place for a question like this. Nevertheless, I hope some of you can give me your opinions, regardless). I am building a forum with Laravel. Progress has been ...
2
votes
0answers
2k views

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-...
2
votes
2answers
170 views

How to improve version control on database structure when migrations take long?

I am working with a team of web developers. We are already using Git for version control of our code and it works well. However, while we are changing our code, it is also common to change the ...
2
votes
1answer
291 views

Advantages and disadvantages of building web app purely with microservices and hybrid with web framework

Definition: Purely microservice: Not using any web framework such as Spring, Laravel, Zend, Django. Web app is a single page app loading data via Ajax calls to web services Hybrid: The web framework ...
4
votes
1answer
239 views

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 ...
2
votes
0answers
202 views

Is Nested Structure with Spread Responsibilities Not Logical?

Given the following code snippet in a Laravel Controller: $this->userRepository->saveByProject( $this->fileRepository->saveByProject( $this->metricRepository->...