Questions tagged [laravel]
Laravel is an open-source PHP web development framework created by Taylor Otwell. Laravel helps you create applications using simple, expressive syntax.
271 questions
2
votes
1
answer
114
views
Using a dynamic custom 404 template in Laravel
I have made a Laravel 8 blogging application that supports themes.
I had made a custom 404 template for every theme, the path to it being ...
5
votes
2
answers
244
views
Laravel as client for Strava 3rd party API
I’m developing a Laravel app which acts as a client to consume a 3rd party Strava API. My app also functions as an API for a frontend SPA. The user (which is just me for the time being) will already ...
4
votes
4
answers
279
views
JavaScript live validation for a registration form
I am working on a blogging application in Laravel 8.
I have added "live validation" to the registration form with JavaScript. For password strength, I use Zxcvbn.
The registration form ...
5
votes
1
answer
559
views
User Management API
I got as task to build a simple Laravel API that should:
1 - Create User API
2 - Get Users API
So I run the artisan command to ...
3
votes
4
answers
783
views
Sanitize URL string for Insertion Upon DB table via Eloquent model
In my case I am saving a URL into my database via Eloquent Model:
...
2
votes
1
answer
109
views
Production-Readiness Advice for Laravel/ PayPal Integration
I am currently working on integrating PayPal with my Laravel application, and it's my first time incorporating PayPal for production use. I have written the following code and would greatly appreciate ...
2
votes
1
answer
200
views
Manually inserting or updating a row with timestamps, without Eloquent
I need to insert or update a row that has created_at and last_update timestamps.
created_at ...
5
votes
1
answer
870
views
Update specific model attributes from a request
Background
This is for an API and I'd like to use this Upsert action to take data from a request and only update the requested fields. I.e. These are partial updates and I will not update every field ...
3
votes
2
answers
277
views
Laravel Event Filtering Controller
So I am currently writing a function in laravel that handles URL parameter filters.
How the code works: So we have the following two URL parameters:
timeframe and <...
1
vote
1
answer
155
views
Theme picker for Laravel 8 blogging application
I am working on a blogging application in Laravel 8.
The application supports themes. In a nutshell, theme support works like this:
In the views directory, I have ...
5
votes
1
answer
2k
views
Setting default of <options> in Laravel with PHP Match
I have a filter component that lets a user filter for events on a website. The user needs to see which category is currently selected in the filter. For this there is a URL with parameters.
e.g. ...
4
votes
0
answers
76
views
Serving Laravel public/ contents when all Laravel files are in the same server directory
I have a Laravel 8 project hosted at xxx/laravel/ on an Apache server, where xxx is the domain. I want to serve the contents of <...
1
vote
1
answer
290
views
Default to array when value is null or false
I'm working with ACF in WP which provides a get_field() function. The function can return an array of values, null or false. ...
1
vote
2
answers
108
views
Check if a new movie session can be inserted
I have this function in my code, this way I validate if a new movie session can be inserted, it works, but I wanted to find a better way to do it.
...
1
vote
1
answer
89
views
Laravel controller getting results based on parameter including relationship results
I am trying to learn to improve my coding on a daily basis and this is one of the first times I am posting on here, so bear with me.
I have two models, a Payment and an Expense model. A ...
3
votes
1
answer
76
views
Retrieve config values using custom helper
I've stored a set of theme related configuration in a config file.
config/theme.php
...
1
vote
4
answers
657
views
table name column name from GET parameter
This is a function that reads a setting data from DB.
...
5
votes
2
answers
528
views
Optimization of a Laravel controller that passes data and views
I am trying to build a website that shows events. And I use the following controller.
Please note that the urls ($view and ...
1
vote
1
answer
213
views
A create gateway controller in Laravel
In my app users can create and soft-delete payment gateways something like Paypal. Users of a website can connect to the gateway and make payments.
I've written the logic in a transaction also locking ...
0
votes
1
answer
677
views
Eloquent eager loading deep nested relation with "where" condition
is there a more elegant way to do what the code below does without use "foreach"?
I am trying to load answers from questions but only the answers that contains a direct relation with an ...
2
votes
1
answer
105
views
Method in Laravel to give a JSON response indicating whether the user may edit
I'm working on creating code with a nice balance between concise and readable.
How would you improve this Laravel code block to make it more compact and readable?
...
1
vote
1
answer
1k
views
Placing store and update logic in Laravel 8 form request
I want some opinions about my code that implements store and update for a Laravel 8 form request. The make function is for storing the data and the ...
1
vote
1
answer
179
views
Login using two-factor authentication
I want to make the code below prettier but I don't know what to change and how to change. I know that the controller should be easy, delegating actions related to models or to services or something ...
4
votes
2
answers
5k
views
Laravel 8 registration and login with user profiles
I am working on a Laravel application (Github repo) that requires user registration and login.
After registration, the users can change their registration details (except password, for which there is ...
4
votes
1
answer
136
views
Single end point REST API
I want to ask question about a better way for implementing single endpoint REST.
I want to build a rest API but I want it to only have single endpoint like: graphql,...