app/Http/Controllers/UserController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $organization_id = $request->organization_id;
        unset($request['organization_id']);
        $user = User::create($request->all());
        $user->organizations()->attach($organization_id);
        return $user;
    }
public function store ( Request $ request ) { $ organization_id = $ request -> organization_id ; unset ( $ request [ 'organization_id' ] ) ; $ user = User :: create ( $ request -> all ( ) ) ; $ user -> organizations ( ) -> attach ( $ organization_id ) ; return $ user ; }
Store a newly created resource in storage.
Store a newly created resource in storage .