/** * covers \Ohio\Core\TeamUser\TeamUser::user * covers \Ohio\Core\TeamUser\TeamUser::team * covers \Ohio\Core\TeamUser\TeamUser::create */ public function test() { $teamUser = new TeamUser(); # user relationship $this->assertInstanceOf(BelongsTo::class, $teamUser->user()); # team relationship $this->assertInstanceOf(BelongsTo::class, $teamUser->team()); # create $teamUser = m::mock(TeamUser::class . '[firstOrCreate]'); $teamUser->shouldReceive('firstOrCreate')->once(); $teamUser->create(); }
public function item($id) { return TeamUser::with('user')->find($id); }
/** * Store a newly created resource in storage. * * @param Requests\CreateRequest $request * * @return \Illuminate\Http\Response */ public function store(Requests\CreateRequest $request) { $teamUser = $this->teamUser->create($request->all()); return response()->json($teamUser); }