Skip to main content

auto fill email phone etc of login user in laravel

one way to check if user is loggen in or not
@if(Auth::check())
<h1>{{Auth::user()->name}}</h1>
@else
<h1>name xaina</h1>
@endif

Next MEthod:
<div class="form-group ">

<span class="data-label" for="rider_email">Your Email</span>
@if(isset(Auth::user()->email))
<input class="form-control" type="email" name="rider_email" id="rider_email" readonly value="{{ Auth::user()->email }}">
@else
<input class="form-control" type="email" name="rider_email" id="rider_email" required>

@endif
@if ($errors->has('rider_email'))
<span class="help-block">
<strong>{{ $errors->first('rider_email') }}</strong>
</span>
@endif
</div>


for seperate guard: also view another blog for more user pannel


@if(isset(Auth::guard('admin')->user()->email))
<input type="text" class="form-control" id="email" name="email" placeholder="Email Address(optional)" readonly value="{{ Auth::guard('admin')->user()->email }}">

@else
<input type="text" class="form-control" id="email" name="email" value="{{old('email')}}" placeholder="Email Address(optional)">
@endif






Comments

Popular posts from this blog

key press function to perform system function

document.onkeyup = function(e) {   if (e.which == 77) {     alert("M key was pressed");   } else if (e.ctrlKey && e.which == 66) {     alert("Ctrl + B shortcut combination was pressed");   } else if (e.ctrlKey && e.altKey && e.which == 89) {     alert("Ctrl + Alt + Y shortcut combination was pressed");   } else if (e.ctrlKey && e.altKey && e.shiftKey && e.which == 85) {     alert("Ctrl + Alt + Shift + U shortcut combination was pressed");   } }; < script > $ ( document ). ready ( function () { $ ( '[data-toggle="tooltip"]' ). tooltip (); $ ( document ). keyup ( function ( e ) { var name = e . key ; // console.log(e.which); // if(e.shiftKey && e.which == 80) // { // } // alert(name); switch ( e . key ){ ...

Convert Html PAge to PDF using Canvas

Link :https://www.quora.com/How-we-export-html-page-as-pdf-using-pure-javascript app.js ( function (){ var form = $ ( '. printme ' ), cache_width = form . width (), a4 =[ 595.28 , 841.89 ]; // for a4 size paper width and height $ ( '#create_pdf' ). on ( 'click' , function (){ $ ( 'body' ). scrollTop ( 0 ); createPDF (); }); //create pdf function createPDF (){ getCanvas (). then ( function (canvas){ var img = canvas. toDataURL ( "image/png" ), doc = new jsPDF ({ unit : 'px' , format : 'a4' }); doc . addImage ( img , 'JPEG' , 20 , 20 ); doc . save ( 'FinalPrint.pdf' ); form . width ( cache_width ); }); } // create canvas object function getCanvas (){ form . width (( a4 [ 0 ]* 1.33333 ) ...

Installing Admin LTE in Laravel

step 1:  Reference---  https://hdtuto.com/article/laravel-56-adminlte-bootstrap-theme-installation-example Step 2 : after completion first reference view this link:    https://github.com/JeroenNoten/Laravel-AdminLTE step 3:  For more additional information view this link:   https://github.com/jeroennoten/Laravel-AdminLTE#2-updating Now you are done statically : https://adminlte.io/blog/integrate-adminlte-with-laravel Steps: 1:  composer require jeroennoten/laravel-adminlte 2: 'providers' => [ .... JeroenNoten\LaravelAdminLte\ServiceProvider::class, ], 3: php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=assets 5: php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=config 6: php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=views 7: for admin pannel php artisan ...