Viewing 1 post (of 1 total)
  • Author
  • #377

    I have view Blade component that receives data from a controller. What are some the reasons this data will be passed upwards to the component?

    If I have a controller:

    public function index() {
    $users = User::all();
    return view(‘users’, [‘users’ => $users]);

    View Component:

    @foreach($users as $user)
    <x-users :user = “$user”>

    Class Component:

    public $user;

    public function __construct($user) {
    this -> user = $user

    • This topic was modified 1 year, 2 months ago by jacob_smith.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.