我如何将参数从视图传递到控制器

How i can pass parameter from view to controller

我如何从视图中获取数据并将其发送到控制器 例如

$banner['Top-right']

我如何将“右上角”发送到控制器 select 此位置的所有横幅

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

我已经为我的问题找到了解决方案,也许将来会对任何人有所帮助

在视图中

@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}}">