1 | <?php |
||
21 | class UserInvitationsController extends Controller |
||
22 | { |
||
23 | /** |
||
24 | * Send Invitation. |
||
25 | */ |
||
26 | public function sendInvitation(SendInvitationRequest $request) |
||
27 | { |
||
28 | return $this->store($request); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Store a newly created resource in storage. |
||
33 | * |
||
34 | * @param SendInvitationRequest $request |
||
35 | * @return \Illuminate\Http\JsonResponse |
||
36 | */ |
||
37 | public function store(SendInvitationRequest $request) |
||
38 | { |
||
39 | $invitation = UserInvitation::where(['email' => $request->input('email')])->first(); |
||
40 | if (!$invitation) { |
||
41 | $invitation = UserInvitation::create($request->only(['email','state','token'])); |
||
|
|||
42 | } |
||
43 | |||
44 | // NOTE : this method trigger method "created" in UserInvitationObserver. Fire also and event to enable hooking. |
||
45 | event(new UserInvited($invitation)); |
||
46 | |||
47 | return Response::json(['created' => true ]); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Remove the specified resource from storage. |
||
52 | * |
||
53 | * @param int $id |
||
54 | * @return \Illuminate\Http\Response |
||
55 | */ |
||
56 | public function destroy($id) |
||
66 | |||
67 | /** |
||
68 | * Display a listing of the resource. |
||
69 | * |
||
70 | * @return \Illuminate\Http\Response |
||
71 | */ |
||
72 | public function index() |
||
73 | { |
||
74 | $this->authorize('list-user-invitations'); |
||
75 | return UserInvitation::paginate(); |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * Display the specified resource. |
||
80 | * |
||
81 | * @param int $id |
||
82 | * @return \Illuminate\Http\Response |
||
83 | */ |
||
84 | public function show($id) |
||
89 | |||
90 | /** |
||
91 | * Update the specified resource in storage. |
||
92 | * |
||
93 | * @param UpdateInvitationRequest $request |
||
94 | * @param $id |
||
95 | * @return \Illuminate\Http\JsonResponse |
||
96 | */ |
||
97 | public function update(UpdateInvitationRequest $request, $id) |
||
103 | |||
104 | /** |
||
105 | * Accept user invitation. |
||
106 | * |
||
107 | * @param Request $request |
||
108 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
109 | */ |
||
110 | public function accept(Request $request) |
||
116 | |||
117 | /** |
||
118 | * Process accept user invitation form. |
||
119 | * |
||
120 | * @param CreateUserWithTokenRequest $request |
||
121 | * @return \Illuminate\Http\JsonResponse |
||
122 | */ |
||
123 | public function postAccept(CreateUserWithTokenRequest $request) |
||
142 | |||
143 | /** |
||
144 | * Validate token. |
||
145 | * |
||
146 | * @param $token |
||
147 | * @return bool |
||
148 | */ |
||
149 | protected function validateToken($token) |
||
164 | |||
165 | /** |
||
166 | * Show accept user invitation form. |
||
167 | * |
||
168 | * @param $invitation |
||
169 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
170 | */ |
||
171 | protected function showAcceptUserInvitationForm($invitation) |
||
179 | |||
180 | /** |
||
181 | * Show the management user invitations page. |
||
182 | * |
||
183 | * @return Response |
||
184 | */ |
||
185 | public function userInvitations() |
||
190 | |||
191 | /** |
||
192 | * Show the user invitations public page. |
||
193 | * |
||
194 | * @return Response |
||
195 | */ |
||
196 | public function invite() |
||
201 | |||
202 | } |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.