Question: In my search bar which is on the folder `book.index.blade.php` I would like to do a search on the `name` of my table `authors` or the field `code` of my table `bookcases`.

[![enter image description here](https://i.stack.imgur.com/BvoY5.png)](https://i.stack.imgur.com/BvoY5.png)

So far, I know to do a search on the field `name` of my table `authors`.
My problem is how to do also the request with the field `code` of my table `bookcases` ? I don't know the syntax... 
I am novice. 

```
public function index(Request $req) 
{
    if ($req->search == "") {
          $books = Book::paginate(5);
          return view('admin.books.index', compact('books'));

    } else {

            $validated = $req->validate([
                'search' => 'alpha', 
            ]);

   $books = Book::whereHas('authors', function($query) use($req) {
            $query->where('name', 'like', '%' . $req->search . '%');
        })->paginate(5);
  return view('admin.books.index', compact('books'));
  }

}

```

Answer: 
The values passed by Input() are not available in the constructor since they are not yet passed to the child.
Consider building your form in the ngOnInit() method and you should be good to go !
Stackblitz - <https://stackblitz.com/edit/angular-9d3bu4-so-56527061>

Make sure the parent has defined the `precio` and `nombre` that you are passing (via one way binding) when you use `<app-reserva [precio]="precio" [nombre]="nombre"></app-reserva>`

***app.component.ts***

```
import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  name = 'Angular';

  precio = 24.50;
  nombre = "boots"
}

```

***app.component.html***

```
<app-reserva [precio]="precio" [nombre]="nombre"></app-reserva>

```