samedi 21 avril 2018

How can I check if user is connected in order to display phone number Laravel

I have a little problem which I can't find a convenient solution to it. I have a button in the user profile page which on click will display the user phone number which was initially hidden. It is working quite alright but what I want is that, in order for the phone number to be revealed, the user must be signed in if not it will redirect the user to the login page with a flash message saying "You must be logged in, in order to view this number"

In my Profile Details View file I have this

<span class="job-is ft"  id="more" onclick="$('.details').slideToggle(function(){$('#more').html($('.details').is(':visible')?'Cacher le numero':'Voir le numero');});">Voir le numero</span>

<div class="extra-job-info details" style="display:none">
    <p style="text-align: center; padding: 10px; font-size: 45px;">
       <i class="la la-phone"></i> 
    </p>
</div>

In my user Controller I have this

public function jobberDetails($id) {
    $profiledetail = User::find($id);

    return view('Users.profileDetail', compact('profiledetail'));
}

My web file

// Route qui permet d'afficher,le profil d'un Jobbeur
 Route::get('/jobber/profiledetails/{id}','UserController@jobberDetails')->where(array('id' => '[0-9]+'))->name('profileDetails'); 



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Hmo8ri
via IFTTT

Aucun commentaire:

Enregistrer un commentaire