Question: I am using this logic in my button i.e if login the buynow class is working else login modal is open.
& code here.

```
 <button class="ps-btn ps-btn--sm @if(session()->has('name')){{'buy_now'}}"@else {{data-toggle="modal" data-target="#loginModal"}}@endif>Buy Now<i class="ps-icon-next"></i></button>

```

Answer: 
You can use below code

```
<button class="ps-btn ps-btn--sm 
    @if(session()->has('name')) buy_now"
    @else " data-toggle='modal' data-target='#loginModal'
    @endif>Buy Now<i class="ps-icon-next"></i>
</button>

```

**Notice:** We use `{{ $variable }}` for echoing a php variable. It is equivalent to `<?php echo $variable ?>`. For more info refer to [laravel displaying data](https://laravel.com/docs/8.x/blade#displaying-data)
**Try this:**

```
<button  session()->has('name') ? class="ps-btn ps-btn--sm buy_now' : "data- 
toggle="modal" data-target="#loginModal">Buy Now<i class="ps-icon-next"></i> 
</button>

```