Category : reactjs

I have the following set-up: Laravel running with Homestead Domain laravel-api.test pointing to my Homestead environment React (npx create-react-app) running locally with a custom HOST app.laravel-api.test:3000 Laravel In my routes (routes/api.php) I added two routes: Route::post(‘login’, [AppHttpControllersLoginController::class, ‘login’]); Route::middleware(‘auth:sanctum’)->get(‘books’, [AppHttpControllersBookController::class, ‘list’]); In my config/cors.php I added: ‘paths’ => [‘api/*’, ‘sanctum/csrf-cookie’], ‘allowed_methods’ => [‘*’], ‘allowed_origins’ => ..

Read more

I am following this React + Laravel tutorial: https://webmobtuts.com/backend-development/building-a-blog-with-reactjs-and-laravel-part-1/ I am currently using Laravel 5.8. I got to Part 4 of the tutorial when I am encountering a "http://reactlaravelproject.test:8000/public/api/check-auth" not found error when the login page loaded and "http://reactlaravelproject.test:8000/public/api/login" not found error when I attempt to log in. I am having trouble figuring out how ..

Read more

I’m using Laravel sanctum to use Rest API’s for Laravel Token based authentication and when I send the request to server using axios to the ‘/register’ route it returns a 422 error code . const handleRegister = async (e) => { e.preventDefault() axios.defaults.withCredentials = true axios.get(`${hostName}/sanctum/csrf-cookie`).then((res) => { axios .post(`${hostName}/register`, { name: ‘admin’, email: ‘[email protected]’, ..

Read more

How can I use Laravel Gate in React JSX? In Laravel blade we can get by this : @can(‘isAdmin’) <div class=”btn btn-success btn-lg”> You have Admin Access </div> @elsecan(‘isManager’) <div class=”btn btn-primary btn-lg”> You have Manager Access </div> @else <div class=”btn btn-info btn-lg”> You have User Access </div> @endcan But how can I do this ..

Read more

I am completely new to react but have been developing a React SPA using the create-react-app package. I have also been developing an API using Laravel and Laravel Sanctum. My API’s endpoints are all at api.example.com. I would like to have my SPA at example.com. Currently the API and SPA are in different repositories. I ..

Read more

I am using React component inside of Laravel blade, I am using the following attributes <div class="card" data-controller="react" data-react-widget-type="Data" data-react-props="someData"></div> It works fine except when I change the DOM element after an event and add new props, then the React component will not be rendered again and the new props will not be used in ..

Read more

I have a Laravel backend project and multiple ReactJS applications accessing to it through API calls. I have no problem with those because I configured config/cors.php to recieve requests to ‘api/‘ from any origin. Also tried to add ‘storage/‘ to paths, but it didn’t work: ‘paths’ => [‘api/*’, ‘storage/*’], ‘allowed_methods’ => [‘*’], ‘allowed_origins’ => [‘*’], ..

Read more

I am integrating with Zoho CRM Insert Contacts, I keep getting an error about date format in php. It keeps giving me an error and message ‘A two digit day could not be found Data missing’ Here is my Php Code: $record->setFieldValue("DATE_OF_BIRTH_1", CarbonCarbon::createFromFormat(‘dd/mm/yyyy’, $clientData[‘birthdate’]) ->format(‘Y-m-d’) I am using ant’d datepicker with format like this: <DatePicker ..

Read more

I currently am using react hook powered component to record my screen, and subsequently upload it to Google Cloud Storage. However, when it finishes, the file created inside Google Cloud appears to be corrupt. This is the gist of the code within my React component, where useMediaRecorder is from here: https://github.com/wmik/use-media-recorder – let { error, ..

Read more