258 questions
0
votes
1
answer
116
views
Laravel API returning HTML instead of JSON when served via NGINX
I’m running a Laravel backend alongside a Vue frontend on NGINX. The issue I’m facing is that my API endpoints are returning HTML instead of JSON. For example:
https://isuecampusmap.site/api/ → ...
2
votes
1
answer
81
views
how to load relation from relation in laravel api resource
I am playing for the first time with API Resource in laravel 12.
I have this situation:
The product has many Skus:
public function skus(): HasMany
{
return $this->hasMany(Sku::class);
}
The ...
0
votes
1
answer
81
views
laravel passport use pkce and approve manulay oauth/authorize
Hello I want to create an authentication system using API with oauth2 pkce and I don't want to use the laravel UI. What suggestions do you have so that I can manually provide the authentication key?
1....
0
votes
0
answers
71
views
Should I Use NextAuth.js for Authentication with a Laravel API in a Next.js (SSR) E-Commerce Site?
I'm building an SEO-friendly e-commerce site. Since I usually work with Inertia.js, React, and Laravel as an SPA (which isn't ideal for SEO), I’ve decided to use Next.js with Server-Side Rendering (...
0
votes
1
answer
46
views
Laravel API and React Frontend: Redirecting to Profile After Submitting Post Results in 404 | Not Found
I have built a web application where the front end is created using React and the backend with Laravel. My application setup is as follows:
Frontend (React): Hosted on the main domain: https://...
3
votes
1
answer
80
views
Issue with ::put and ::delete Method in Laravel API - 404 Error Instead of JSON Response
I am developing a Laravel API and am encountering issues with my ::put method. I can successfully create and retrieve a model, but when I attempt to delete or update, I receive Laravel's 404 page ...
1
vote
0
answers
84
views
In Laravel 11 how can I get the Review data to be displayed in a paginated fashion while still using ReviewCollection?
I've got the following in a App\Http\Resources\V1\BookResource.php that I would like to paginate.
"reviews" => new ReviewCollection(
$this->reviews()
->where("...
1
vote
0
answers
114
views
Laravel Appending Request Body to Response with 200 Status Code
I am getting an issue on hitting the Laravel API. The following issue occurs:
The API is hit and returns an incorrect response twice, with the request body being appended along with a 200 status code. ...
2
votes
1
answer
643
views
How to separate categories in JSON with Laravel Resource API
I was trying to build an API with Laravel but I failed to categories data from a table.
The API JSON should look like this:
[
{
id: 1,
name: 'John Doe',
birth_place: 'Birmingham',
...
0
votes
1
answer
337
views
problem with routes API laravel in cPanel
A few days ago I uploaded my laravel project to my hosting with my test domain, in cPanel.
There I could see that my vue components were not loading, I did not see the data tables, etc..
Searching, I ...
0
votes
1
answer
443
views
Laravel 11 - Executing php artisan install:api is giving "Symfony\Component\Process\Exception\ProcessStartFailedException"
I set up a new Laravel 11 project and try to install API routes by executing php artisan install:api command.
This results in the below error.
Laravel install api error
OS: Mac OS Sonoma 14.3.1 (23D60)...
0
votes
0
answers
42
views
Target class does not exist when I'm trying to acces API route
When I'm trying to access my route via http://localhost:8000/api/dnd/array, I get error:
Target class [Api/DndController] does not exist.
https://flareapp.io/share/87ndNRBm
I've use these commands to ...
-1
votes
1
answer
48
views
Reorganizing controller files in Laravel
In Laravel, I can't find my controller after rearranging the file and folder structure in app/http/controller. I wanted to organize my controller files due to their large number. Here's how it looks ...
0
votes
0
answers
58
views
API Call to your own Laravel Project
I am struggling to make an API call to my project. Can someone assist me here?
This is the command I am entering:
curl.exe -X PUT http://hsk.local/api/v1/applicants/1 \ -H "Content-Type: ...
1
vote
1
answer
1k
views
Error 419 (unknown status) CSRF token mismatch. | Laravel Sanctum + Fortify + Vue SPA
I get a "419 (unknown status)" error when sending a post request to login user
POST http://localhost/login 419 (unknown status)
Network request response : "message": "CSRF ...
0
votes
3
answers
1k
views
How can I shorten Laravel API response time?
I was pulling the data this way, but when I query with Postman, it takes too long to get the response.
public function getAllItems(Request $request)
{
$type = $request->input('type');
...
0
votes
1
answer
127
views
How to show response json of validation errors in Blade
I'm working with Laravel and this is my RegisterController Class based on API:
class RegisterController extends AuthController
{
public function register(Request $request)
{
$validator ...
0
votes
2
answers
208
views
I can't do methods made work in Laravel API
I am using Laravel to create records using APIin api.php than using the form, but I am having difficulties with the methods, for example the store() method is not inserting the record I want in ...
0
votes
1
answer
3k
views
How to use stateful and stateless Laravel API Authentication
I'm currently building an API using Laravel and need two different authentication types and would just like some input on weather I'm thinking correctly before implementing everything.
The API will ...
1
vote
0
answers
135
views
Problem with getting a response from the API in Russian
In my Laravel application, I ran into a strange problem.
I get a response from the API, but everything is in spaces in Russian, and everything is OK in English. Please tell me how to fix it?
...
1
vote
1
answer
46
views
Laravel API, communication between two web domain (main <- other). only accept for specific domain that allowed to requesst [duplicate]
Here I ask for implementation laravel API and Laravel APP communicating each other.
Here's how the flow supposed to be:
Laravel API side, can retrieve all request from outside that had account and ...
0
votes
1
answer
510
views
How can I create a belongsToMany relationship with Laravel JSON:API?
I am familiar with creating a Many To Many relationship using Laravel.
In my example, I have many resources that share many activities. I have been able to successfully create this relationship in ...
1
vote
0
answers
418
views
How to fetch all classes of a specific flight for the seat map with Amadeus APIs?
I am making a seat map for a flight using Amadeus APIs?
In the documentation there are two ways to fetch the seat map data,
https://developers.amadeus.com/self-service/category/flights/api-doc/seatmap-...
0
votes
0
answers
27
views
I am using laravel one to one relation and getting the null value exception on the data from other table
I can access my holder class data but i can't seems to access data that is coming from devices table. i have used postman to check my api and it return the data ok and also when i print_r the data on ...
1
vote
1
answer
214
views
Middleware Not Functioning Only on API Routes in Laravel 9.19
I have set up a project and written some routes in the api.php route file. I created a middleware, registered the middleware in the Kernel.php file, and then implemented the middleware in the api.php ...
0
votes
1
answer
171
views
tokenCan() method undefined
I am currently following this tutorial,
https://nothingworks.netlify.app/blog/laravel-sanctum-multi-auth/
However when creating the middleware, the tokenCan method is undefined.
<?php
namespace ...
0
votes
1
answer
21
views
Reactive value not updating based on dependent value
I have a project of Roles and Permission in Laravel API based with Vue.js frontend. In Add Roles page if clicking the "All" checkbox, all roles are checked but no data appears in ...
1
vote
1
answer
1k
views
Understanding Laravel exception handling catching exceptions in the controller that have been thrown in service layer
Trying to create an API server with laravel. I have seen many tutorials that catch the exception thrown in the service layer. However, in Laravel, we have an option to create a custom error handler ...
0
votes
0
answers
201
views
Laravel - "The file failed to upload" on shared hosting
So im currently working on a simple REST API in Laravel. I have a post function which sends entered data to database and uploads one file. Everything works fine on local. Image is uploading to storage/...
0
votes
1
answer
2k
views
Laravel api routing issue: Route [login] not defined
I am using Laravel as back end for my project. Passport package is being used for authentication of api request. But I am getting error for login.
Kindly suggest me what and where I am missing.
...
0
votes
0
answers
61
views
Upload folder over laravel api using flutter
I want to upload a directory over laravel api without compressing the directory, I want to select the directory and upload it, is there any way to do it?
I searched too much for it but I didn't find ...
2
votes
1
answer
324
views
In Php, while calling a parametrized SQL Server stored procedures, how to get data from output parameters?
In Laravel 10, I'm using raw PHP code to call an as my stored procedure is returning 2 tables.
But I'm not able to receive the output parameters in either way. Is there any way to get the output ...
3
votes
2
answers
2k
views
Target Enum Type is not instantiable
I want to call a route which binds to parameter from the route which the enums have the enum type with a value of integer. However, after calling it I get error 500 with this error message Target [App\...
-1
votes
2
answers
246
views
Laravel API Call to a member function createToken() on null
AuthController
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Http\Requests\Api\RegisterRequest;
use Illuminate\Http\Request;
use Illuminate\...
-1
votes
1
answer
85
views
Laravel API didn't return the desired output
Route::group(\['namespace' =\> 'API\\V1'\], function () {
Route::group(['prefix' => 'auth', 'namespace' => 'Auth'], function () {
Route::get('registration', [CustomerAuthController::...
0
votes
0
answers
240
views
How to i handle Laravel error if script fails InvalidArgumentException: View [welcome] not found
When my script fails in a Laravel 9 app, instead of it to outputing the JSON I configured, it shows this:
InvalidArgumentException: View [welcome] not found. in file C:\Users\kgl\Documents\biomandate\...
0
votes
1
answer
678
views
Encounter CORS Policy from Reactjs to Laravel 8 api
I have API using laravel 8. This API was made each Module. Laravel API running in localhost port 8000. Then i have reactjs app running in localhost port 3000. If i access api by URL or Rest Client ...
0
votes
2
answers
71
views
Flutter Login type 'int' is not a subtype of type 'String'
This is my file user_model.dart
class UserModel {
int id, nik;
String password, token;
UserModel(
{required this.id,
required this.nik,
required this.password,
required ...
2
votes
2
answers
2k
views
Using same controller for web route and api route?
I am working on building API and so far I've familiar with the web route.I was wondering can we share the same controller for both web and API.
I already have a controller file which is working for ...
0
votes
2
answers
90
views
Laravel Package Development - How To Public Path Access in URL
In Laravel pacakage development, the asset() function is not working. How can I properly use it? I also need to get the URL path of the public folder.
0
votes
0
answers
910
views
pass data to another component vuejs 3 and composition API
I´m trying to send data to my component table when i clicked a button. My another component should fill a table with data received. i´m using composition API. To try this i´m building this code:
in my ...
1
vote
0
answers
185
views
Laravel 9 API with sanctum authentication in production api route not working
I have created APIs with sanctum authentication and moved the laravel application into the production server after uploading it to the server, the production API route are not working
I have check my ...
4
votes
3
answers
4k
views
Object of type Illuminate\Auth\AuthManager is not callable [closed]
As part of API development, I use Laravel 9 and use "php-open-source-saver/jwt-auth" package for authentication without tokens. The API works fine, but I get an error when I add the ...
0
votes
0
answers
315
views
Auth::user() return null in route non authentication
I've route api without middleware
I want to access Auth::user() in my controller but Auth::user always return null,
Here my api route and my controller:
Route::get('products/{product}', [...
0
votes
1
answer
39
views
Json key format change in laravel
I created API like this Json response.
{
"product_category_id": 1,
"branch_id": 1,
"product_category_code": "00184050",
"...
0
votes
3
answers
173
views
Unable to fetch data from relational table using laravel with() method
I have table "Jobs" having a field called "empids". we are storing comma separated employee ids in this field, for ex. 1,12,56. I am trying to return JSON using with() method by ...
0
votes
0
answers
50
views
I am trying to get driver related to vehicle using vue js
I have shown vechicle data just I want to get driver data related to vehicle but unfortuntly i am getting error undefined please help me how can i show into draggablelist thank u ?
Controller
public ...
1
vote
0
answers
134
views
Laravel 9 Resources adds array key
I'm trying to generate a Resource with the same model. But in the response it adds a key which i don't know where it comes from.
Here is the api call:
Route::get("/definitions/{companyId}", ...
1
vote
1
answer
509
views
Get and post data in flutter with API from Laravel [duplicate]
Can anyone show me how to get and post data with API in flutter? I have tried some flutter API tutorials with Laravel but when I print the value is error cors, something wrong with my flutter code or ...
1
vote
1
answer
144
views
Converting Laravel "return view($this->theme" to return Json data
I bought this Codecanyon WebApp project which i want to use the APIs to develop a mobile version (fluter & Dart) of same system, only for me to realise theres no API i can use to integrate those ...