dimanche 29 avril 2018

How to show values without column name in laravel

I want to display Values and hide Column Names.

Here is my UserProfileView.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class UserProfileView extends Model
{
    protected $dates = ['created_at'];
    
    protected $hidden = ['id', 'user_id', 'ip', 'updated_at'];
        
    public function user()
    {
        return $this->belongsTo('App\User');
    }
}

Here is my User.php

 public function views()
    {
        return $this->hasOne('App\UserProfileView');
    }

Finally in profile.blade.php

<h5>Register Date</h5>
<h5 class="highlight"></h5>

And I get this: Register Date {"created_at":"2018-04-18 22:18:39"} How can I only show the date and nothing else? I think this has something to do with Eloquent but I'm not sure.

Cheers! (Sorry for using snipped)



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

Aucun commentaire:

Enregistrer un commentaire