http://localhost/site/public/api/user/friend/2/4
mi controller está asi:
namespace App\Http\Controllers;
Código:
Por motivos de espacio no he pegado el resto de acciones del controlador. use Illuminate\Http\Request; use App\Http\Requests; use App\User; use App\Profile; use DB; use JWTAuth; use Tymon\JWTAuth\Exceptions\JWTException; use Friendly; public function ask_friend($requesterId, $receivingId) { // Requester user. $userRequester = User::where('id', $requesterId)->first(); // Receiving user. $userReceiving = User::where('id', $receivingId)->first(); // may include "pivot" data. $userRequester->befriend($userRequester, [ 'name' => $userRequester->email, 'other_name' => $userReceiving->email, 'start' => date('Y-m-d') , ]); }
La configuración la he hecho tal cual indican en la docu que he pasado anteriormente.
Y el mensaje de error es este:
Código:
Gracias de antemano. dingo {"message":"Call to undefined method Illuminate\\Database\\Query\\Builder::befriend()","status_code":500,"