Giter Site home page Giter Site logo

Comments (8)

sroutier avatar sroutier commented on September 15, 2024

Hello @Parq,

It should work just the way that you described it. Not sure what could be wrong at this point.
Can you check the storage/logs/laravel.log file for any hints?

If that does not help, try to turn on the SQL_LOG=true option in the .env file and look at the storage/logs/sql-YYYY-MM-DD.log.

Hopefully you will be able to see what is going on while you search for a role.

Let me know.
Cheers.
/S

from laravel-enterprise-starter-kit.

pablorq avatar pablorq commented on September 15, 2024

From laralvel.log:

[2018-03-07 20:57:15] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-07 20:57:15] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-07 20:57:16] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-07 20:57:16] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-07 20:57:18] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-07 20:57:18] local.ERROR: Debugbar exception: A non well formed numeric value encountered

From sql log:

{"bindings":["root"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-07 20:57:18] sql.INFO: select * from routes where routes.id = 14 limit 1 {"bindings":[14],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-07 20:57:18] sql.INFO: select * from menus where menus.id = 8 limit 1 {"bindings":[8],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-07 20:57:18] sql.INFO: select * from routes where routes.id is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-07 20:57:18] sql.INFO: select * from menus where menus.id = 4 limit 1 {"bindings":[4],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-07 20:57:18] sql.INFO: select * from routes where routes.id is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-07 20:57:18] sql.INFO: select * from menus where menus.id = 1 limit 1 {"bindings":[1],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []

Any idea?

from laravel-enterprise-starter-kit.

sroutier avatar sroutier commented on September 15, 2024

In the SQL log I do not see any query for a role.
What you should see is two entries caused by a search as such:

[2018-03-07 22:15:26] sql.INFO: select * from `users` where `users`.`id` = 1 limit 1 {"bindings":[1],"time":0.40000000000000002,"request_path":"admin/roles/search","request_method"
:"GET","request_data":{"query":"admin"}} []


[2018-03-07 22:15:26] sql.INFO: select * from `roles` where `display_name` like '%admin%' or `description` like '%admin%' {"bindings":["%admin%","%admin%"],"time":0.429999999999999
99,"request_path":"admin/roles/search","request_method":"GET","request_data":{"query":"admin"}} []

Crazy to say but look to me like either you did not do a search or perhaps you captured the log too soon.
Just to be sure, give the log system enough time to write the entries, it may not be 100% synchronized. A few seconds should be enough.

Could also be that the query never left your browser. The search is using AJAX so it will happen in the background. Can you check your Web server logs to make sure that a query was received? On my Web server (Apache) I see the two entries:

192.168.96.1 - - [07/Mar/2018:17:15:13 -0500] "GET /admin/users/2/edit HTTP/1.1" 200 75743 "http://l51esk-dev.vmdom/admin/users/2" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36"

192.168.96.1 - - [07/Mar/2018:17:15:26 -0500] "GET /admin/roles/search?query=admin HTTP/1.1" 200 584 "http://l51esk-dev.vmdom/admin/users/2/edit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36"

The first one shows that I am editing since the request is for GET /admin/users/2/edit the second one shows a search GET /admin/roles/search?query=admin

If you log your Web server errors in separate files make sure that the error logs is empty for this period of time. If not send the entry over, it may tell us what is going on.

If that all looks good, then I would suggest that you look on your Web Browser to make sure that the AJAX query was sent. If you are using Google Chrome open the Developer Tools and on the "Network" tab you should be able to see a request and (hopefully) response.

Let me know.

/s

from laravel-enterprise-starter-kit.

pablorq avatar pablorq commented on September 15, 2024

The query seems to be there:

wamp server access log:

127.0.0.1 - - [08/Mar/2018:15:27:55 +0100] "GET /lesk/public/ HTTP/1.1" 302 388
127.0.0.1 - - [08/Mar/2018:15:27:55 +0100] "GET /lesk/public/welcome HTTP/1.1" 200 13674
127.0.0.1 - - [08/Mar/2018:15:27:59 +0100] "GET /lesk/public/auth/login HTTP/1.1" 200 4234
127.0.0.1 - - [08/Mar/2018:15:28:06 +0100] "POST /lesk/public/auth/login HTTP/1.1" 302 376
127.0.0.1 - - [08/Mar/2018:15:28:06 +0100] "GET /lesk/public/home HTTP/1.1" 302 388
127.0.0.1 - - [08/Mar/2018:15:28:07 +0100] "GET /lesk/public/welcome HTTP/1.1" 200 25334
127.0.0.1 - - [08/Mar/2018:15:29:31 +0100] "GET /lesk/public/admin/users HTTP/1.1" 200 30942
127.0.0.1 - - [08/Mar/2018:15:29:34 +0100] "GET /lesk/public/admin/users/2 HTTP/1.1" 200 56257
127.0.0.1 - - [08/Mar/2018:15:29:37 +0100] "GET /lesk/public/admin/users/2/edit HTTP/1.1" 200 70964
127.0.0.1 - - [08/Mar/2018:15:29:43 +0100] "GET /admin/roles/search?query=admin HTTP/1.1" 404 300

laravel log:

[2018-03-08 14:27:55] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:27:55] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [dashboard], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [reservation.index], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [audit], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [error], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [modules], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [menus], guest [1], username [].
[2018-03-08 14:27:56] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [users], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [roles], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [permissions], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [routes], guest [1], username [].
[2018-03-08 14:27:56] local.WARNING: Authorization denied for menu [setting], guest [1], username [].
[2018-03-08 14:27:56] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:27:59] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:28:06] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:28:06] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:28:07] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-08 14:28:07] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:29:31] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-08 14:29:31] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:29:35] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-08 14:29:35] local.ERROR: Debugbar exception: A non well formed numeric value encountered
[2018-03-08 14:29:37] local.DEBUG: Menu has no children and/or no permission set for the requested menu [menus-users-separator], guest [], username [root].
[2018-03-08 14:29:37] local.ERROR: Debugbar exception: A non well formed numeric value encountered

sql log:

[2018-03-08 14:29:37] sql.INFO: select * from menus where name = 'home' limit 1 {"bindings":["home"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.id is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where name is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where url = '/admin/users' limit 1 {"bindings":["/admin/users"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from routes where name = 'admin.users.edit' limit 1 {"bindings":["admin.users.edit"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where route_id = 20 limit 1 {"bindings":[20],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from routes where routes.id = 3 limit 1 {"bindings":[3],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.parent_id = 2 and menus.parent_id is not null and name != 'root' order by position asc, label asc, id asc {"bindings":[2,"root"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from routes where routes.id = 5 limit 1 {"bindings":[5],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from permissions where permissions.id = 3 limit 1 {"bindings":[3],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.parent_id = 3 and menus.parent_id is not null and name != 'root' order by position asc, label asc, id asc {"bindings":[3,"root"],"time":10,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from routes where routes.id is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from permissions where permissions.id is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.parent_id = 16 and menus.parent_id is not null and name != 'root' order by position asc, label asc, id asc {"bindings":[16,"root"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from routes where routes.id = 107 limit 1 {"bindings":[107],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from permissions where permissions.id = 16 limit 1 {"bindings":[16],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.parent_id = 17 and menus.parent_id is not null and name != 'root' order by position asc, label asc, id asc {"bindings":[17,"root"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.id = 'admin' limit 1 {"bindings":["admin"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where name = 'admin' limit 1 {"bindings":["admin"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where menus.id is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where name is null limit 1 {"bindings":[],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where url = '/admin/users' limit 1 {"bindings":["/admin/users"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from routes where name = 'admin.users.edit' limit 1 {"bindings":["admin.users.edit"],"time":0,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []
[2018-03-08 14:29:37] sql.INFO: select * from menus where route_id = 20 limit 1 {"bindings":[20],"time":10,"request_path":"admin/users/2/edit","request_method":"GET","request_data":[]} []

The timestamp from laravel and sql seems to be shifted 1h from real time. Wamp log timestamp is ok.

from laravel-enterprise-starter-kit.

pablorq avatar pablorq commented on September 15, 2024

I've installed the 'reservation' module and ajax seems to work inside the module.

from laravel-enterprise-starter-kit.

sroutier avatar sroutier commented on September 15, 2024

Think I found why!

Look at the last two lines of your WAMP server log:

127.0.0.1 - - [08/Mar/2018:15:29:37 +0100] "GET /lesk/public/admin/users/2/edit HTTP/1.1" 200 70964
127.0.0.1 - - [08/Mar/2018:15:29:43 +0100] "GET /admin/roles/search?query=admin HTTP/1.1" 404 300

The user edit request path is /lesk/public/admin/users/2/edit, while the AJAX role search is /admin/roles/search?query=admin. I am not sure how you configured the Web application but the path do not match. I would expect the path for the user edit to be /admin/users/2/edit not /lesk/public/admin/users/2/edit.

A Laravel application should not make anything outside of the public directory available.

How did you configure your Apache server for this application?

Here is one of my HTTPD config file as an example:

<VirtualHost *:80>
    <Directory /var/www/lesk51dev/public>
        AllowOverride All
        Require all granted
    </Directory>
    DocumentRoot /var/www/lesk51dev/public
    ServerName lesk51dev.priv
    ServerAlias lesk51dev

    # Other directives here
    ErrorLog /var/www/lesk51dev/storage/logs/httpd-error.log
    CustomLog /var/www/lesk51dev/storage/logs/httpd-requests.log combined
</VirtualHost>

Note 1: I use virtual host to have all my instances served as root applications
Note 2: The Directory and DocumentRoot both point to /var/www/lesk51dev/public

How does it look on your end?

/s

from laravel-enterprise-starter-kit.

pablorq avatar pablorq commented on September 15, 2024

That's it!

I was running the app from localhost/lesk/public. No virtualhost configuration at all.

Now I did the default WAMP Virtual Host configuration:

<VirtualHost *:80>
	ServerName lesk
	DocumentRoot "c:/wamp64/www/lesk/public"
	<Directory  "c:/wamp64/www/lesk/public/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>

Now it works!

Tx!

from laravel-enterprise-starter-kit.

sroutier avatar sroutier commented on September 15, 2024

👍 Cool. Enjoy!

from laravel-enterprise-starter-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.