Rinvex laravel-addresses

September 20, 2021, at 6:40 PM

As a beginner Laravel, as using it for few weeks, I find it very frustrating and lost with Rinvex Laravel address and their instruction is a bit lost for beginner people like me, I have lookup google and seems not many details or induction on Rinvex Laravel Address


I have completed without issue

Install the package via composer:

composer require rinvex/laravel-addresses

Publish resources (migrations and config files):

php artisan rinvex:publish:addresses

Execute migrations via the following command:

php artisan rinvex:migrate:addresses


I have done above without any issue and add trait in model

To add addresses support to your eloquent models simply use \Rinvex\Addresses\Traits\Addressable trait.

use Illuminate\Database\Eloquent\Model;
use Rinvex\Addresses\Traits\Addressable;

on user app

namespace App;
use App\Models\League;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use Laravel\Passport\HasApiTokens;
use Mpociot\Teamwork\Traits\UserHasTeams;
use Illuminate\Database\Eloquent\Model;
use Rinvex\Addresses\Traits\Addressable;
use Storage;

class User extends Authenticatable
    use HasApiTokens,Notifiable,HasRoles;
    use UserHasTeams;
     * The attributes that are mass assignable.
     * @var array
    protected $fillable = [
        'name', 'firstname','surname','email', 'password', 'avatar'
     * The attributes that should be hidden for arrays.
     * @var array
    protected $hidden = [
        'password', 'remember_token',
     * The attributes that should be cast to native types.
     * @var array
    protected $casts = [
        'email_verified_at' => 'datetime',

    public function get_roles(){
        $roles = [];
        foreach ($this->getRoleNames() as $key => $role) {
            $roles[$key] = $role;
        return $roles;
    // get avatar url attribute
    public function getAvatarUrlAttribute()
        return Storage::disk('s3')->url($this->avatar);

but this next step where I am lost, as it said on the model but I assume it is more like a controller page?

// Get instance of your model

$user = new \App\Models\User::find(1);
// Create a new address
    'label' => 'Default Address',
    'given_name' => 'Abdelrahman',
    'family_name' => 'Omran',
    'organization' => 'Rinvex',
    'country_code' => 'eg',
    'street' => '56 john doe st.',
    'state' => 'Alexandria',
    'city' => 'Alexandria',
    'postal_code' => '21614',
    'latitude' => '31.2467601',
    'longitude' => '29.9020376',
    'is_primary' => true,
    'is_billing' => true,
    'is_shipping' => true,
// Create multiple new addresses
// Find an existing address
$address = app('rinvex.addresses.address')->find(1);
// Update an existing address
    'label' => 'Default Work Address',
// Delete address
// Alternative way of address deletion
$user->addresses()->where('id', 123)->first()->delete();

I have tried to put this code above on the model.

then I create PHP blade pages

<div class="form-group">
       <label for="Street">{{ __('Street')}}</label>
       <input type="Street" value="{{Auth::user()->addresses->street}}" class="form-control" name="Street" id="Street">

but an error appears on it

ErrorException Trying to get property 'street' of non-object (View: C:\laravelCrud\resources\views\common\profile.blade.php)

it doesn't make sense as I would like to see the user have their own home address

Can&#39;t import from absolute paths using Typescript and NodeJS

Can't import from absolute paths using Typescript and NodeJS

I've tried many things to solve this issueI'm trying to import from absolute paths defined on my tsconfig

How to store data from user into Array or ArrayList? [closed]

How to store data from user into Array or ArrayList? [closed]

Want to improve this question? Add details and clarify the problem by editing this post

not rendering content until needed

not rendering content until needed

I am trying to make my webpage load quicker and be more responsiveI am loading in upto 4k images that a user can scroll down through, apply filters to, and sort

RecyclerView Filter is not filtering (Kotlin)

RecyclerView Filter is not filtering (Kotlin)

I started the debugger and my breakpoints show that on the first startup the dataset is being transmitted as the adapter is being initialized, but as soon as I call the filter it doesn't have any data to work with and my recyclerview just stays as it was before