Ahmed Saad
Ahmed Saad

Reputation: 53

How i can pass parameter from view to controller

How i can get data from view and send it to controller for example

$banner['Top-right']

how i can send "Top-right" to controller to select all banner in this location

//$location = Top-right
$banner=Banners::where('location',$location)->first();

Upvotes: 1

Views: 54

Answers (1)

Ahmed Saad
Ahmed Saad

Reputation: 53

i have find a solution for my problem maybe help anyone in future

in View

@php
  $bannersTopright=App\Models\Banners::where('status','1')->where('location','Top-right')->first();
@endphp

<img src="{{Storage::url('images/banners/cache/'.$bannersTopright->image)}}" alt="{{$bannersTopright->name}}">

Upvotes: 1

Related Questions