Does users table have type column? In that case Auth::user()->type
Sep 19, 2018
4
Level 3
User API
I am developing an api, and on a certain route I need to register a company, but only with the profile 'proponent', how do I get the type of logged in user?
`class ProgramsController extends Controller { /** * @var Programs */ private $programs;
/**
* ProgramsController constructor.
*/
public function __construct(Programs $programs){
$this->programs = $programs;
}
public function index(){
$programs = Programs::all();
return response()->json($programs);
}
public function createPrograms(ProgramsRequest $request){
$perfil = auth()->user();
return response()->json(
$this->programs->create($request->all()), 201
);
}
}`
Please or to participate in this conversation.