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.

1
vote
1answer
32 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
16 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
102 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
109 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
122 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
73 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
42 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
37 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
63 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
63 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
78 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
156 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
78 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
143 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
49 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
199 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
357 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
80 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
407 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
68 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
470 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
191 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
118 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
849 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
79 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
513 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
79 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
927 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
148 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
389 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
854 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
550 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
246 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
207 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
316 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
439 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
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
169 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
946 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
100 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
55 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 ...