Skip to content

Instantly share code, notes, and snippets.

@EricMcWinNer
Created July 22, 2021 03:11
Show Gist options
  • Save EricMcWinNer/07f89920f07568651319b09015a03bed to your computer and use it in GitHub Desktop.
Save EricMcWinNer/07f89920f07568651319b09015a03bed to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers\Employer\Dashboard;
use App\Http\Controllers\Controller;
use App\Models\User;
class HomeController extends Controller
{
public function getUser($id) {
$user = User::find($id);
$user->first_name; // The accessor has to be "accessed" for the function to work.
$user->phone_number; // This would create this property and do the concatenation.
return response(['data' => $user], 200);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment