shell bypass 403
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Response;
use App\Models\Product;
use App\Models\ProductComment;
class ProductCommentController extends Controller
{
//
public function insert(Request $req)
{
$id = $req->proId;
$product = Product::find($id);
if(!$product)
{
return response()->json(['proerror'=>'Product Not Found!']);
}
$validation = Validator::make($req->all(),[
'Comment' => 'required|max:3000',
'userName' => 'required|max:100',
'userEmail' => 'required|email:rfc',
],[
'Comment.required' => 'Please Enter Comment Text',
'Comment.max' => 'Comment Max Length Is 3000',
'userName.required' => 'Please Enter Name',
'userName.max' => 'Name Max Length Is 100',
'userEmail.required' => 'Please Enter Email',
]);
if(!$validation->passes())
{
return response()->json(['error'=>$validation->errors()]);
}
else
{
$AddComment = new ProductComment;
$AddComment->product_id = $id;
$AddComment->user_name = $req->userName;
$AddComment->user_email = $req->userEmail;
$AddComment->comment = $req->Comment;
$AddComment->rating = $req->star_rating;
$AddComment->save();
return response()->json(['success'=>'Comment Add Successfully']);
}
}
}