Simplest way to achieve saving an HTML to a user login account via the `php artisan make:auth` process?
What is the simplest way to achieve saving an HTML element to a user login via the php artisan make:auth process?
Breaking this down I want to achieve:
php artisan make:auth (Done this, in Laravel 5.5.40 LTS and the latest PHP version 7.1 it all works fine)
When a user logs in they can amend the HTML element <p>Hello</p> using JavaScript or whatever via an HTML <input></input> box of some sort and say hypothetically they change this <p> element to "Goodbye" string.
The user logs out, then logs in the next day on a different computer or in incognito mode in a browser for whatever reason, the text string "Goodbye" is now assigned to there user account only, only they will see this new <p> element string data of "Goodbye" rather than "Hello" unlike the other users.
How would I achieve something like this because either I have missed in the tutorials, it is done automatically or I am not searching for the right methods to achieve this? I understand that would save into a new database / table possibly?
Not sure if I understand you correctly but you isn't this exactly equal to for example a username? Only you don't call it a username but you call it a 'html element'? If yes than:
Create a database migration
Add an extra field to the user table called greeting or whatever you call it
Create a form where the user can enter this value.
Save the value on the user:
\Auth::user()->update(['greeting' => $value]);
// do not forget to add `greeting` to the `$fillable` array of the user model.
Show it in your html
<div class="greeting">
<!-- show the greeting if available, otherwise show 'Hello'. -->
{{ Auth::user()->greeting ?: 'Hello' }}
</div>
I suppose you are doing this to try a few things out with Laravel but I would not recommend to store html if not necessary (like the <p> tag in your example). If it is only a greeting you want to change you should just only store the actual value like: Hello, Goodbye, Hi there, howdy, etc.
Is there no tutorial anywhere that goes through this in more detail, especially steps 1 to 4, struggling to get my head around the basics, and yeah I meant the text within the element not the element itself sorry if that was not clear.
This is the thing, I have gone through laravel from scratch up to about episode 17 (does not show on profile as I download the videos so I can take notes when offline) where you build the auth system then looking ahead I can't see 'specifically' what video goes into detail on what you have mentioned above, either way your information is useful so thanks for that.