Closed minedun6 closed 9 years ago
Hi,
Did you add Mpociot\Teamwork\TeamworkServiceProvider::class
To your config/app.php ?
yes i did, I followed all steps
Can you tell me, what line 30 in the TeamsController is? Which version of laravel are you using?
here's the code : public function create(Request $request) { $team = new Team(); $team->owner_id = User::where('username', '=', 'sebastian')->first()->getKey(); $team->name = 'My awesome team'; $team->save(); }
and I'm using L5
I need the code on line 30, not the whole block
$team = new Team();
Hm, OK. Can you give me the full error output? The issue title got truncated.
And how does your Team model look like?
For the team model it's just
class Team extends TeamWork{}
As for the full error it's
ErrorException in Teamwork.php line 24: Missing argument 1 for Mpociot\Teamwork\Teamwork::__construct(), called in C:\wamp\www\IAmLegend\app\Http\Controllers\TeamsController.php on line 30 and defined
Ah, that's the problem. The team model should extend TeamworkTeam.
Like this:
class Team extends TeamworkTeam { }
Yeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah My bad !! I was really stupid to forget that !!
i did exactly as the documentation said and i got this error when i tried to execute it -_-
Here's what i wrote
public function create(Request $request) { $team = new Team(); $team->owner_id = User::find($request->get('leader')); $team->name = $request->get('name'); $team->save();