Closed NilakshaPerera closed 3 years ago
I’m seeing a orderByUser
, maybe that’s the name instead? I haven’t actually looked at this library for a little while, definitely deserves some cleanup. Let me know if that works and I can add in a orderByUsers as well as an alias.
On Sep 30, 2021, 8:57 PM -0700, Nilaksha Perera @.***>, wrote:
Trying to sort users by using this method and it fails. Below is the log. production.ERROR: Call to undefined method Illuminate\Database\Eloquent\Builder::orderByUsers() {"userId":336,"exception":"[object] (BadMethodCallException(code: 0): Call to undefined method Illuminate\Database\Eloquent\Builder::orderByUsers() at C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:50) [stacktrace]
0 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php(36): Illuminate\Database\Eloquent\Builder::throwBadMethodCallException('orderByUsers')
1 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(1356): Illuminate\Database\Eloquent\Builder->forwardCallTo(Object(Illuminate\Database\Query\Builder), 'orderByUsers', Array)
2 C:\xampp\htdocs\homebrew\chatni\_chat\app\Http\Controllers\HomeController.php(101): Illuminate\Database\Eloquent\Builder->__call('orderByUsers', Array)
3 [internal function]: App\Http\Controllers\HomeController->getPublicChat(Object(Illuminate\Http\Request))
4 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): call_user_func_array(Array, Array)
5 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('getPublicChat', Array)
6 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\HomeController), 'getPublicChat')
7 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Route.php(176): Illuminate\Routing\Route->runController()
8 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Router.php(680): Illuminate\Routing\Route->run()
9 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
10 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
11 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
12 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
13 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Auth\Middleware\Authenticate.php(43): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
14 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
15 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
16 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php(75): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
17 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
18 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
19 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
20 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
21 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
22 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(56): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
23 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
24 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
25 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
26 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
27 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
28 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
29 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
30 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
31 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
32 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Router.php(682): Illuminate\Pipeline\Pipeline->then(Object(Closure))
33 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Router.php(657): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
34 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Router.php(623): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
35 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Router.php(612): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
36 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
37 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
38 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
39 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
40 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
41 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
42 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
43 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
44 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
45 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
46 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
47 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
48 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
49 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
50 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\fideloper\proxy\src\TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
51 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
52 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
53 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
54 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
55 C:\xampp\htdocs\homebrew\chatni\_chat\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
56 C:\xampp\htdocs\homebrew\chatni\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
57 {main}
"}
Anything I need to check before calling this function? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
That worked fine. Thank you very much
Trying to sort users by using this method and it fails. Below is the log.
Anything I need to check before calling this function?