Question: I have to program a function which only accepts strings and counts my elements in a list, when it gets a number it has to count it as 1 and letters as 2. I don't know how to use `isNumber` after `import Data.Char`

```
import Data.Char

f1 [] = 0
f1 x = if x isNumber then (if True then 1 else False) else 2
f1 x = (head x) + sum (tail x) 

```

Answer: 
You are using the same variable names in your foreach loops : 

```
foreach ($posts as $post) {
    foreach ($allusers as $user) {
        if ($post->creator_id == $user->user_id) {
          array_push($post,$user->username); 
        }
    }
}

```

But for your issue, you should try to add this in your Post Model

```
public function user(){
    return $this->belongsTo(User::class, 'creator_id', 'user_id);
}

```

then in your view : 

```
@foreach($posts as $post)
    {{ $post->user->name }}
@endforeach

```

<https://laravel.com/docs/5.4/eloquent-relationships#one-to-many-inverse>
Does your users table has a column like user\_id?

I think you have check with users table id with posts creator\_id.