Category : postman

I have a problem with Sanctum and Postman that’s related to this post: SPA Authentication Issues with Sanctum and Postman I followed everything from the Laravel docs about Sanctum and configured it correctly. Then I followed this tutorial: https://blog.codecourse.com/laravel-sanctum-airlock-with-postman/ Everything is working except for POST requests. When I do login, it works. But then I ..

Read more

In my Laravel project, I want to add a "cust_id" as a foreign key from the customer table to customer detail table. This is the migration code I have used for customer detail table. Schema::create(‘cust_details’, function (Blueprint $table) { $table->id(‘custdetail_id’); $table->string(‘address’); $table->string(‘street’); $table->string(‘city’); $table->string(‘postalCode’); $table->string(‘ContactNo’); $table->foreignId(‘cust_id’)->nullable()->constrained(‘customers’); $table->timestamps(); }); The CustDetailsController I used, <?php namespace AppHttpControllers; ..

Read more

I’m working with Laravel 8 and Passport for API. And currently I have this route: Route::prefix(‘v1’)->group(function(){ Route::get(‘/courses’, [AppHttpControllersApiv1CourseController::class, ‘index’]); Route::get(‘/courses/{course}’, [AppHttpControllersApiv1CourseController::class, ‘single’]); Route::post(‘/courses’, [AppHttpControllersApiv1CourseController::class, ‘store’]); Route::post(‘login’, [AppHttpControllersApiv1UserController::class, ‘login’]); Route::post(‘register’, [AppHttpControllersApiv1UserController::class, ‘register’]); Route::middleware(‘auth:api’)->group(function() { Route::get(‘/user’ , function () { return auth()->user(); }); Route::post(‘/comment’ , [AppHttpControllersApiv1CommentController::class, ‘store’]); }); Now I can correctly send a request on Postman ..

Read more

I have a small Laravel application. I developed an API and using postman to get data. But somehow the laravel server seems to be closing connection and reopening on a different port whenever I make an api request. The log is as follows: C:ProjectsPHPsecurity>php artisan serve Starting Laravel development server: http://127.0.0.1:8000 Development Server (http://127.0.0.1:8000) started ..

Read more

i have this problem in Laravel 8 on postman : SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (sayara_wipou2021.post, CONSTRAINT post_user_id_foreign FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) (SQL: insert into post (id, title, description, price, category_id) values (?, post700, description ..

Read more

In my Laravel project, I have created the cproduct table which has 3 foriegn keys. Now I need to add data to that table using postman. How can I do that. c_products table I use, public function up() { Schema::create(‘c_products’, function (Blueprint $table) { $table->bigIncrements(‘cproduct_id’); $table->string(‘name’); $table->string(‘file_path’); $table->integer(‘price’); $table->foreignId(‘category_id’)->nullable()->constrained(‘p_categories’); $table->foreignId(‘cactus_id’)->nullable()->constrained(‘cacti’); $table->foreignId(‘id’)->nullable()->constrained(‘users’); $table->timestamps(); }); } This ..

Read more

For my laravel project, I created the product category table and add data to the table. Now I need to get each product_category detail using get method. This is the product category table that I created, public function up() { Schema::create(‘p_categories’, function (Blueprint $table) { $table->bigIncrements(‘category_id’); $table->string(‘name’); $table->string(‘size’); $table->timestamps(); }); } CategoryController I use, <?php ..

Read more

I want to ask you here. I use the postman. Want to test the input function in the controller when I try to test in the postman. The page is expired. Though my route and my function name is correct. Am I missing something? my route Route::post(‘displayantri/input’,[KelolaAntriController::class,’input’]); my function public function input(Request $Request){ $response = ..

Read more

laravel api with laravel sanctum "the file cannot be opened." trying to upload files with laravel api using laravel media library package with postman with the code below the files uploaded successfully but error appears. " "message": "The file cannot be opened.", "exception": "RuntimeException", "file": "C:Siteshtdocshome-services.appvendornyholmpsr7srcFactoryPsr17Factory.php", "line": 46," foreach ($request->additional_files as $file) { $order ->addMedia($file) ..

Read more

For my Laravel assignment I am using models to create add products. However, the postman gives me the error of class not found. I am a bit stumped on that to be honest. Here is the AProductController I use: <?php namespace AppHttpControllers; use IlluminateHttpRequest; use AppModelsAProduct; class AProductController extends Controller { // function addAProduct(Request $req) ..

Read more