I'm trying to use a **loop insinde laravel `return view()`** to pass mutltiple variables. So that no need to hard code them and this list has 30 items and it always select 8 values randomly. So this is my code

```
 return view ( 'shop.landing' , [
            for($z = 0 ; $z <8 ;$z++){
                'productMatchesToMasterCategory' => ($masterCategoryList[$z]['name'].$productMatchesToMasterCategory);
            }
            'tomorrow' => Carbon::tomorrow () ,

```

This is the snap

[![snap ](https://i.stack.imgur.com/a3NMb.jpg)](https://i.stack.imgur.com/a3NMb.jpg)

So could anyone please tell whats wrong in my code or is it not allowed to use a loop inside `view()`?

Thanks