Guys I am a partial **\_create-note-modal.blade.php** and I am trying to share this partial with all the pages and this works perfectly because I included it in the **main.blade.php** template.

> 
> Problem:
> 
> 
> 

This **\_create-note.blade.php** partial file get all the **users** from the database using eloquent. This **users** variable need to be share with all the other views because it will get error.

> 
> What I have tried:
> 
> 
> 

I tried to write this in my Controller.php.

```
$users = User::all();
View::share('users', $users);

```

> 
> Question is:
> 
> 
> 

Is that the best way? and what about If I have an entire function that I want to share?

> 
> Notes:
> 
> 
> 

`$users = User::all()` get all the users but actually my project is a CRM for a company that have 25 users on the CRM and won't have more than 100 in the future which is even hard to happen.

Also I return all the users just to view them in `<select>` and `<option>` choose.

Any better solution?

Thanks