Hello guys I am new to Laravel and I recently competed my rest Api which is working fine when I tested on local host it is giving me output when i uploaded this rest Api on hostinger it gives me issues like put and post request working as get request I am testing my Api on Postman and I don't know What to do
I followed this tutorial
and i use this video for uploading project on hostinger
I was expecting all things work but post and put request not working.
This is my controller
public function store(Request $request){
$validator = Validator::make($request->all(),[
'name' => 'required|string|max:191',
'course' => 'required|string|max:191',
'phone_no' => 'required|digits:10',
'email' => 'required|string|max:191',
]);
This is my model class
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserModel extends Model
{
use HasFactory;
protected $table = 'users';
protected $fillable = [
'name',
'course',
'email',
'phone',
];
// protected $primarykey = "id";
}
This is my route
Route::get('student', [UserController::class, 'index']);
Route::post('student', [UserController::class, 'store']);
Route::get('student/{id}', [UserController::class, 'show']);
Route::get('student/{id}/edit', [UserController::class, 'edit']);
Route::put('student/{id}/edit', [UserController::class, 'update']);
What is happening when I try to post request through postman I am getting datas like get request no error is showing
Bolow is example it's not belong to my code but i shown the example and it's not same as mine data
I except this result on pust request
But I am getting this result on post request
I followed this toturial https://youtu.be/57Ej3X6tzfw
It's working fine in my computer on local host but when I uploaded on hostinger the post and put request acting like get