Category : request

I find something lost… The problem I need to construct 2 custom FormRequest from 1 normal Request Let’s suppose this fake scenario First FormRequest StoreClientRequest Second FormRequest UpdateClientRequest On the Controller: public function store(Request $request){ //Do something… $firstRequest = new StoreClientRequest($request); $secondRequest = new UpdateClientRequest($request); } Are there way to make something similar to this ..

Read more

I created routes with type (POST), and when visit it directly, it get this error: The GET method is not supported for this route. Supported methods: POST. how to handle getting this error if anyone visit it from URL without press a form submit or something like that. the routes: Route::group([‘middleware’=>’guest:web’], function(){ Route::post(‘/post-login’, [LoginController::class,’postLogin’])->name(‘site.postLogin’); Route::post(‘/register-create’, ..

Read more

I want to check in the Instagram, if account exists, do something. But if accounts doesn’t exist, echo error. I am creating a condition with checking status code. Here is a code: <?php $username = ‘ddddddmsdklmklmfklmfklsd’; $url = ‘https://instagram.com/’.$username.’/’; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Accept: application/json’) ..

Read more

I am new to PHP and I am trying to build a joomla module that displays the current BTC Price. I am using this API: https://api.coindesk.com/v1/bpi/currentprice.json I cannot find out how to access the USD and EUR "rate". This is where I am currently (ignore the var_dump, I used it to verify I was receiving ..

Read more

I added a custom Endpoint : add_action( ‘rest_api_init’, function () { register_rest_route( ‘api’, ‘/my_posts’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘fetch_my_posts’, ) ); } ); and inside the function i am not able to access the $_REQUEST object : $client_id = $_REQUEST[‘clientID’]; this is my function : function fetch_my_posts( WP_REST_Request $request) { if (ISSET($_REQUEST[‘clientID’]) && ..

Read more