title: Laravel how to return selected column with auth:user()
body: <p>From last few days, I have started learning Laravel with Passport and followed this wonderful article <a href="https://medium.com/techcompose/create-rest-api-in-laravel-with-authentication-using-passport-133a1678a876" rel="noreferrer">Create REST API in Laravel with authentication using Passport</a>. </p>
  
  <p>I have created the login, register, detail listing API but in the login API I am trying to return logged in user details in JSON and it returns all information but I want only <code>id, name, email, phone</code> so how to apply <code>select('id', 'name', 'email', 'phone')</code> on <code>$user = Auth::user()</code></p>
  
  <p>I can easily remove data using PHP unset function but I don't want to use that. I want to select only column which is required so is it possible?</p>
  
  <h2>My Controller Source Code:</h2>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\API;
  
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  use App\User;
  use Illuminate\Support\Facades\Auth;
  use Illuminate\Support\Facades\Validator;
  
  class PassportController extends Controller
  {
      public function login()
      {
          if (Auth::attempt(['email' =&gt; request('email'), 'password' =&gt; request('password')])) {
              $user = Auth::user();
              $success['token'] = $user-&gt;createToken('MyApp')-&gt;accessToken;
  
              return response()-&gt;json(['data' =&gt; $user, 'success' =&gt; $success], 200);
          } else {
              return response()-&gt;json(['error' =&gt; 'Unauthorised'], 401);
          }
      }
  }
  </code></pre>
  
  <h2>API JSON Result:</h2>
  
  <pre><code>{
      "data": {
          "id": 1,
          "name": "Abraham Hess",
          "first_name": "Abraham",
          "last_name": "Hess",
          "phone": "982595360",
          "email": "abraham@mailinator.com",
          "username": "abraham",
          "created_at": "2018-05-29 16:58:55",
          "updated_at": "2018-05-29 16:58:55"
      },
      "success": {
          "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjFiYjQ3OWY3MzlkZTAxNjc0Njc4Nzg3Mjg2ZTU4NGI0NjljNjE2OGUxNGUyZWUzYmJlOWViMWIwMTUxMzhhZWI3ODU0NjViNTgzZTQ5ZjVlIn0.eyJhdWQiOiIxIiwianRpIjoiMWJiNDc5ZjczOWRlMDE2NzQ2Nzg3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