Add link in user drop down menu using Laravel - laravel-5

When a user is logged in they see the standard drop down menu in the top right (which is created by Laravel). I'd like to create a "Settings" page where logged in users can go to edit their personal info, upload profile photos etc.
I can't figure out how to add a link to the users drop down menu in the top right?
I've tried adding a link in web.php
Route::get('/settings', 'HomeController#settings')->name('settings');
I'm new to Laravel so am probably missing something obvious!

The default Laravel authentication uses the layout at resources/views/layouts/app.blade.php which you can see in the first line of the auth views (e.g. resources/views/auth/login.blade.php):
#extends('layouts.app')
Note that the dropdown entries are different for guests and logged-in users using #guest, #else and #endguest.
For the styling you can refer to the Bootstrap Navbar docs.

Related

Is there a way to dynamically import a Vue component from the Laravel/Inertia backend based on a successful authentication check?

In an application with user profiles where a user can view information about themselves, I would like to add a 'Delete this user' button that only appears for logged-in admin users.
Using Inertia, I can check a user is an admin on the backend, then serve the page with return inertia('Page', [admin => true]); in the page data, and render the button based on that boolean.
My concern is that if there is sensitive information in the component that should only be shown to admins (let's say, in this example, I don't want users to know an admin can delete their account), a user has still downloaded that component when they loaded the page which imports it, even if through normal usage it would not be rendered into their DOM.
How can we get around this issue? Is it possible to entirely hide the existence of a Vue 3 component behind an authentication gate when using Laravel & InertiaJS?
For example, if I wanted to hide all evidence of the button in an application using blade for layout, I might do:
#if($admin === true)
<button onClick="http://my-secret-url.com/">Delete user</button>
#endif
Which doesn't provide the user with an opportunity to intercept the response from the server and change the 'admin' variable to true in order to see the button.

How to show data as per users in Voyager Laravel

Voyager is one of the most efficient admin panel for laravel. But, here I am trapped in a typical situation. For example, I am using this admin panel for booking appointment. I want the admin to view all the records but the user to view, edit, delete only the records which he had added. I can insert my own Page there but that will increase the work as I have to create my own add, edit, and delete functionality along with the view. I just want to know the place where the data is fetched from database to display on the view page so that as per the login user I could manipulate it.
To achieve this:
You need to add policy to your bread php artisan make:policy PostPolicy
Inside the policy you can specify who can edit what depending on your logic

Accessing database data in Laravel Spark kiosk settings

I have added a new page under kiosk settings under API keys. On my new panel I have a select box and I need to populate it with values from a database table.
I'm not sure how to best do this. There seems to be this Spark.state object where the user and team values are put, so if I guess this might be a place.
Or else I load it with Ajax???
This is so easy in normal Laravel I just pass the object from the controller to the view and build the box on the blade view.
Am I missing something? How would i best do this?
Thanks
The way Spark is built with inline-templates, you can still use blade like normal.
You've created the new link in the menu sidebar, so now copy what the other settings are doing by having a tabcard be displayed when the menu item is clicked.
I recommend creating a new blade file for your new menu item and including it in that tabcard. You'll see some examples in the Spark settings blade file. Because you're using blade to render it, you don't need to load anything through AJAX.

How to disable user registration in Joomla 3.x

In Older versions this option was at Global Configuration section.
At joomla 3.x seems that this option has been moved.
I want only my existing users to be able to login.
Has anyone any idea where this option is available? Thanks in advance!
Log into your Joomla 3.0 admin dashboard
In the top menu, click Users and then click User Manager
In the tabs toward the top of the page, click the Options tab
Under the Component tab, find the following setting:
Allow User Registration
If set to Yes, new Users allowed to self-register.
To disable user registration, set Allow User Registration to No, and then click the Save button in the top left of the page.
After disabling the registration option, you will notice that the Create an account link within your Login Form will no longer show, as users can no longer create an account on their own.
Reference
It's very simple ,Follow the steps below:
a)select System --> Global Configuration -->Users manager.
b)Under the component tab you will see the 1st option as Allow user registration.
Please refer the screenshot below.

Joomla ACL: Only allow access to custom component in the backend?

I'm building a component for the backend. I don't want the users who will access it to access ANYTHING else in the backend except for this component.
I tried following these two instructions:
http://www.aclmanager.net/blog/general/31-how-to-add-basic-acl-support-to-your-extension
http://docs.joomla.org/Developing_a_Model-View-Controller_%28MVC%29_Component_for_Joomla!1.6_-_Part_14#Describing_the_ACL
I made a new User Group with a parent of public and allow admin login (which would lock them out of everything) and then tried adding the ACL code from those links above with permissions to create and edit but I just get a blank screen (not even a logout link). The "Debug Permissions Report" showed the correct permissions but nothing's showing up.
Any ideas? My next step is to manually go through every component and not allow access to that new User Group but it seems like there's an easier way.
Thanks!
In Joomla! 2.5 we regularly create "Content" only backend users that have access only to the 'com_content' component.
Going back through our steps the only thing you haven't specified is adding the new user group to a View Access Level. If you're using the standard sample content installed when setting up a Joomla! website you can add your new user group to the "Special" view access (although any will do).
If a new group has 'admin login' privileges it can login but without a View Access level it can't see anything.. it's a subtle difference but it's the way Joomla! works.

Resources