Exemple #1
0
 /**
  * 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();
 }
Exemple #2
0
 public function item($id)
 {
     return TeamUser::with('user')->find($id);
 }
Exemple #3
0
 /**
  * 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);
 }