首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Invite方法不存在

Invite方法不存在
EN

Stack Overflow用户
提问于 2019-02-19 17:36:47
回答 1查看 66关注 0票数 0

我需要所有的邀请函。这是我想在一家公司下做的,当该公司被选中时,必须邀请出来,现在我得到了错误。

方法invite不存在(我在Vue.js中很新)

Overview.vue代码

代码语言:javascript
复制
<v-container fluid grid-list-md>
   v-layout v-if="query === 'invites'" align-space-between justify-center row fill-height wrap>
   <span v-for="invite in invites" :key="invite.id">{{ invite.email }}</span>
</v-layout>

InviteController索引:

代码语言:javascript
复制
public function index( Manager $fractal, InviteTransformer $inviteTransformer ) {

        Auth::user()->authorizeRoles( 'user.view' );

        // Get all companies
        $companies = Auth::user()->companies()->get();
        $invites = $companies->invites()->get();

        // Restructure for output
        $collection = new Collection( $invites, $inviteTransformer );
        $data = $fractal->createData( $collection )->toArray();

        return $this->respond( $data );
} 

ComapnyModel:

代码语言:javascript
复制
<?php

namespace App\Models\Manage;

use Illuminate\Database\Eloquent\Model;

class Company extends Model {

    // This table does not have timestamps
    public    $timestamps = false;
    protected $fillable = [ 'name' ];


    public function users() {

        return $this->hasMany( 'App\Models\Manage\User' )->orderBy('lastname')->orderBy('firstname')->orderBy('id');
    }

    public function userIds() {

        return $this->users()->pluck('id');
    }

    public function admins() {

        return $this->belongsToMany( 'App\Models\Manage\User' )->orderBy('lastname')->orderBy('firstname')->orderBy('id');
    }

    public function adminIds() {

        return $this->admins()->pluck('id');
    }

    public function invites() {

        return $this->hasMany( 'App\Models\Manage\Invite' )->orderBy('email')->orderBy('id');
    }

}
EN

回答 1

Stack Overflow用户

发布于 2019-02-20 19:14:48

我自己决定需要删除->get();

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54762953

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档