Questions tagged [laravel]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

Multitenant setup with master account

I would like to make a SaaS which would be a multitenant system. Development is done in Laravel, which is less important. What I would like to know is how would you handle having a master admin ...
0
votes
0answers
23 views

Laravel web middleware on API routes

I am using Laravel 5.8 and am designing an API. I was wondering if there is a setback to using a web middleware in API context? I have created a new middleware for API routes which uses sessions, ...
0
votes
0answers
31 views

Optimal database design for different types

I am trying to build an application, where users can create unlimited "parsing fields", that will contain either a: String Array id | name | type ------------------- 1 | name | string 2 | table |...
3
votes
2answers
380 views

Should on each test create and nuke a testing database?

In my case I inherited a poorly engineered code, on that piece of code I have been tasked to increase the code coverage in integration tests. But instead of the usual pattern: Create/Populate a test ...
0
votes
0answers
22 views

Building an API for long distance customers with IOS App, single or multiple calls?

I am in the process of building an API in Laravel and my server is currently stored in the UK. Now I have read some of the posts relating to this topic on Stack but I am still a little unsure as to ...
0
votes
2answers
121 views

How to avoid duplicate code in two similar MVC controllers

I have two panels, one for the admins and the other for partners. And there are two OrderController with Admin\OrderController and Partner\OrderController namespaces. They both look very similar. ...
1
vote
1answer
33 views

modular system (packages) with dependencies?

I am building few sites for my company's client. The sites are mostly the same but could have some customisations. so we decided to create duplicate sites instead of multi-tennant and we decided to ...
0
votes
0answers
30 views

Creating and Approving OAuth2 clients using Laravel Passport

As I understand with laravel passport, in order for a third party application to consume my api they need to register their application with mine by creating a client. The passport:client artisan ...
2
votes
2answers
139 views

How to generate an access token using OAuth 2.0 for another app that never expires

I'm using OAuth 2.0 with Laravel (Passport) in order to grant access to my frontend app to the API. Access tokens generated this expires after a while. Now, I have a second app that has to consume ...
2
votes
1answer
115 views

PHP - Dynamically apply parsing rules to text, and save to dynamic fields

OK, so I have been at this problem for the last few days, and I must admit - I am stuck. I am trying to make a web application, where users can upload documents or send inbound e-mails. Each ...
1
vote
1answer
133 views

PHP - Designing a rule based parsing engine

Dynamically apply methods/"rules" to documents I hope someone here can help me/guide me in the right direction. I am currently creating a web application, where users can import a text file, and then ...
1
vote
1answer
74 views

Data is in database or get from API, where should API request code goes?

For me, the data I want to retrieve may be in database for which I can use properties of model and also relationships, but if the record is not a property and no relationship exists for that ...
2
votes
0answers
45 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 (...
-2
votes
1answer
38 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
78 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
79 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
85 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
191 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
89 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
166 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
52 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
232 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
409 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 ...
0
votes
1answer
83 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
439 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
84 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
507 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
231 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
119 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
1k 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
85 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
549 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 ...
3
votes
1answer
82 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
1k 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
158 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
417 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
971 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
584 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
248 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
3k 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
209 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
318 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
442 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
3k 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
6k 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
65 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
174 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, ...