Welcome Guest, Not a member yet? Register   Sign In
User placeholder user picture if not set?
#1

Hello.

I extended myth auth to have user picture, so I can acces that property like this:

PHP Code:
<?= user()->profile_pic ?>

What would the best approach display a stock image if picture is not set?   Should i validate right in the view like this?
PHP Code:
<?php
$userpic 
= !(user()->profile_pic 'custom_pic.jpg : user()->profile_pic;
?>

Or it would be a better practice to do this in the controller and just recieve in the view the pic like a variable already validated?
Reply
#2

Ok nevermind I just created a helper function to handle this
Reply




Theme © iAndrew 2016 - Forum software by © MyBB