Routes Route::view(‘/{path?}’, ‘app’); Route::post("users/signup", "[email protected]"); Route::post("users/email/verify", "[email protected]"); Route::get("users/email/resend", "[email protected]"); Verify email once the user clicks on their email <?php namespace AppHttpControllers; use AppMailVerifyEmail; use AppModelsUser; use IlluminateHttpRequest; use IlluminateSupportFacadesMail; class EmailVerificationController extends Controller { public function verify( Request $request){ $user = User::where($request->input("token") ,"verification_token"); if($user){ $user->markEmailAsVerified(); $user->email_verified_at = now(); return response()->json(["msg" => "Email has been verified"]); ..
Category : axios
I have a route in api.php which I need to use ‘web’ middleware on to check for csrf verification because I don’t want that route to be accessible from outside. I have read the following solutions: Laravel “CSRF token mismatch” for POST with laravel-cors and axios CSRF Token mismatch, laravel and axios Laravel + Vue.js ..
I’m having trouble with Vue.js and Axios to fetch pdfs in my Laravel app. When ever a user clicks this button: <a @click="fetchData()"><i class="fas fa-file-download mouse-pointer"></i></a> My fetch method is being called in Vue.js: methods: { fetchData() { axios.get(this.fetchUrl, {responseType: ‘arraybuffer’}) .then(response => { let blob = new Blob([response.data], { type: ‘application/pdf’ }) let link ..
I have this feature in my project where I have to import the records of students and save to Database using csv file. I’m wondering how can I display the number of students that has been saved in the database while the uploading is in progress until it is completed? For example: (In the front-end) ..
I have an axios call in which I am making from the front end of Laravel to the controller. It works fine on local using valet but in staging on an apache machine, I lose the extra parameter. Here is my code on the front: const formData = new FormData(); formData.append(‘file’,video) formData.append(‘video_name’, videoName) for (var ..
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]’, ..
I am using Laravel Sanctum to authenticate and apply CSRF tokens to my React SPA. The documentation says that setting the csrf header should be handled automatically for me but that has not been my experience. I have seen some posts suggesting to disable http_only but surely disabling this isn’t the right way to go ..
I’m using Ionic with Vue 3 and Axios to post data. I have this in my post request: axios.post(url, {name, image}); And I get them in my PHP side like this: echo $request->input("name"); echo $request->file("image"); I’m able to get the name but the problem is that I can’t get the image. I can see that ..
I am using vue and laravel. I getting an array of objects like this in console.log(array_of_obj) : […] 0: Object { id: Getter & Setter, employee_id: Getter & Setter, manual_id: Getter & Setter, … } 1: Object { id: Getter & Setter, employee_id: Getter & Setter, manual_id: Getter & Setter, … } ..
If it’s just formData, I can send it. But if you put other data together, formData will be empty. const formData = new FormData(); formData.append(‘file’, files); axios.post(‘/api/upload’, { formData, route: this.$route.params.test }, { headers: { ‘content-type’: ‘multipart/form-data’, }}).then(response => { console.log(response); }); Is there any way to solve this? Sourc..

I’m using Laravel and Vue’s component, and when i try to access the banners property from response returned by axios in vue component it gives me undefined. I am accessing the perperty like response.data.banners I’m returning data from controller in following way: public function getBanners(Request $request){ return response()->json([‘ banners’=> BannerImage::active()->get() ]); } Here is how ..
I’m currently building a single page application based on Laravel and VueJS. Is there any better way then mine to handle errors with axios? This is how I currently do it when a user clicks on login button: VueTemplae: methods : { authenticateUser() { axios.post(‘/api/login’, this.form).then(() => { this.$router.push({name : ‘home’}); }).catch((error) => { this.error ..
I am using Laravel and Vue. When I was searching on the internet I saw the following code. <script> export default { data() { return { movie: {} } }, methods: { createMovie() { this.axios .post(‘http://localhost:8000/api/movie/create’, this.movie) .then(response => ( this.$router.push({name: ‘movie’}) )) .catch(error => console.log(error)) .finally(() => this.loading = false) } } } I ..
I’m working with vuejs and want to submit files using axios I try to append files to FormData but it still not working The only thing I know how to do is showing the file’s name <template> <div> <div class="row"> <div class="col-lg-9 col-md-9 col-sm-12"> <div class="form-inline mb-3 pt-3"> <label for="date">Date:</label> <input type="date" name="date" id="date" min=’2020-05-08′ ..
Currently I am developing an app where the user can scroll infinite through products. Frontend is vue, my backend is laravel which contains my pictures. The image of the product is loaded via axios.get to my laravel api. <v-card> {some other components} <v-img :src="loadProductImage(product.nr)" contain/> {some other stuff} </v-card> This, of course, only triggers when ..
I’m a bit stuck right now. I want to create an export using Maatwerk Laravel-Excel. The user must be able to set some filters. In Vue I will set the selected values when selected. When the button is pressed the user must receive the download. In Vue: data() { return { selected: { manufacturers: [], ..

I am fairly new to Laravel, Vue and Vuetify but, after a lot of struggling, I’ve gotten my CRUD app to work with MySQL, at least as long as I pass my Controller good data. But now I’m struggling with the right way to do error handling. I use Vuetify to do my front-end error ..
I need your help I’m making a shopping cart in laravel with vuejs. I have the following problem I am new to vuejs I am inserting products from a component A where is my form in vue I insert it but I have no response in my component B where is my table where the ..
maybe I am missing sth completely but I need to access pictures that are located on a ftp folder via laravel. The frontend is vue which calls the data over api. This works without a problen when retrieving, editing and setting simple .xml files to the storage. However, once I try to get an image ..
I started learning Vue.js but i cannot figure this out: I have this function: getTotalUser: function (book_id) { axios.get(‘/total/’ + book_id) .then((response) => { console.log(response.data) return response.data; }) .catch(function (error) { console.log(error) }); } I call the function inside a v-for loop, like this: <tr v-for="(book, index) in books"> <td>{{ getTotalUser(book.id) }}</td> </tr> The function ..

I am trying to create a like/dislike button system for blog posts in a project. I am using axios to send a request to the controller in the event of any click on the like or dislike button. Here is my script on home blade <div class="d-flex justify-content-center"> <button type="button" class="btn btn-outline-success btn-sm " onclick="actOnReact(event);" ..
I have been struggling to get past the CORS error I am receiving. I keep getting in my console this error: Access to XMLHttpRequest at ‘http://localhost:8000/register’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. I have added CORS ..
I’m making a website using NuxtJS for the front-end, and Laravel for the backend. I need to have some data available on every page, so I fetch it using the nuxtServerInit function like so: async nuxtServerInit({ commit }, { $axios }) { const items= await $axios.$get(‘items’) commit(‘saveItems’, items) } This works fine when pointing to ..
I am having a problem uploading an image from a from a form in a vue file. I tried several ways to do this but it seems the file is not properly being set. I have set "enctype="multipart/form-data" in my form tag Here is my input element: <input @change="onFileChange" type="file" accept="image/*" class="form-control" name="file" id="file" aria-describedby="helpId" ..
I have a problem retrieving data from mysql to a table using Axios and Vue Js. I get an error http://localhost:8000/api/allusers 403 (Forbidden). This is my code: UserController <?php namespace AppHttpControllers; use IlluminateHttpRequest; use Appuser; use IlluminateSupportFacadesHash; class UserController extends Controller { public function __construct() { $this->middleware(‘role:user|superadministrator’); } public function index() { return view(‘user.index’); } ..