Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tilamap365's avatar

How to hide json data from network tab

I use laravel and vue to menage some data from db, and i return json format from laravel controller to vue js. I just want to hide the response data from network tab or to mask them maybe. I didnt does this before. I mean, when i open network tab i see a request get-users?page=1 and if i double click open this urlhttp://127.0.0.1:8000/admin/users/get-users?page=1 witch show me all data like this

// http://127.0.0.1:8000/admin/users/getusers?page=1

{
  "data": [
    {
      "id": 1,
      "name": "Admin",
      "email": "[email protected]",
      "email_verified_at": null,
      "last_online_at": "2022-12-02 10:27:20",
...

is there any way to mask this data to somethink like this

// http://127.0.0.1:8000/admin/users/getusers?page=1

{
  "data": [
    {
    	success: true,
		response: null //or true  
    }

this is how i return users data

return new UserResource(User::paginate($paginate));
0 likes
7 replies
Sinnbeck's avatar

Then dont send the data using ajax, and dont use vue. Use pure blade files :)

Or you can make sure to limit the data you send to data they are allowed to see

1 like
tilamap365's avatar

@Sinnbeck So you are saying that using axios it is not possible to mask the data that comes in the network tab.

I also limit them by using UserResource but sometime for some other data are displayed some data thay user does not need to see

Tray2's avatar

@tilamap365 Anything that is sent to the user (browser) is readable in the dev tools network tab, there is no way around it. If you fear that someone other than the user might read the data, make sure that you use https, which encrypts the traffic between the browser and the server. However, once it reached the browser it becomes readable again.

Make sure to fetch only the data that the users are allowed to see.

You can use the $hidden property in the model to define which fields you don't want to fetch from the database, or you can use Model::query()->select('field1', 'field2')->get() in your controller.

1 like
tilamap365's avatar

@Tray2 I see, and i am ussing resource to ferch only data that i need anywhay. I think i will use hide method on model for field i dont want to display.

Thank you

tilamap365's avatar

@Sinnbeck I alredy use api resource like thi return new UserResource(User::paginate($paginate));

Please or to participate in this conversation.