Laravel проблема с get

88
22 февраля 2022, 17:00

Вид list.blade.php

<!-- СПЕЦ ОДЕЖДА ОТЧЁТ --> 
 
 
 
<?php 
	use Illuminate\Support\Arr; 
	use App\Models\Role; 
	$root_url = Role::root_url(); 
	 ?> 
 
 
 
 
 
      <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.css" /> 
      <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid-theme.min.css" /> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.js"></script> 
 
 
@extends('layout') 
 
@section('title') 
 
@stop 
 
@section('content') 
 
 
 
 
 <h2 class="main-header">Отчёт по спец одежде</h2> 
<br> 
  <div id="grid_table"></div> 
 
<script> 
 
	 $('#grid_table').jsGrid({ 
 
		width: "100%", 
		height: "600px", 
 
		filtering: true, 
		inserting:true, 
		editing: true, 
		sorting: true, 
		paging: true, 
		autoload: true, 
		pageSize: 50, 
		pageButtonCount: 20, 
		deleteConfirm: "Do you really want to delete data?", 
 
		controller: { 
		 loadData: function(filter){ 
			return $.ajax({ 
			 type: "GET", 
			 url: "/spec_od", 
			 data: filter 
			}); 
		 }, 
 
 
		}, 
 
		fields: [ 
		 { 
			 name: "firm", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
		 { 
			name: "sotr", 
	 type: "text", 
	 width: 150, 
	 validate: "required" 
		 }, 
		 { 
			name: "tovar", 
	 type: "text", 
	 width: 150, 
	 validate: "required" 
		 }, 
		 { 
			 name: "dat_pri", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
		 { 
			 name: "kol_ost", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
		 { 
			 name: "st_ost", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
		 { 
			 name: "sr_isp", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
		 { 
			 name: "dat_spis", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
		 { 
			 name: "kod_tov", 
		type: "text", 
		width: 150, 
		validate: "required" 
		 }, 
 
		 { 
			type: "control" 
		 } 
		] 
 
	 }); 
 
</script> 
 
 
@stop

Контроллер SpecController.php

<?php namespace App\Http\Controllers; 
 
use Auth; 
use Input; 
use DB; 
use PDO; 
 
class SpecController extends Controller { 
 
	public function __construct() 
	{ 
		; 
	} 
 
	public function getIndex() 
	{ 
	  
		ini_set('display_errors', 1); 
 
 
 
 
 
					return view('spec_od/list') ; 
	} 
 
	  public function getList() 
	  { 
			$connect = new PDO("pgsql:host=localhost;dbname=CommonDB", "postgres", "postgres"); 
			// 
			$method = $_SERVER['REQUEST_METHOD']; 
 
			if($method == 'GET') 
			{ 
 
 
			 $data = array( 
				':firm'   => "%" . $_GET['firm'] . "%", 
				':sotr'   => "%" . $_GET['sotr'] . "%", 
				':tovar'     => "%" . $_GET['tovar'] . "%", 
				':dat_pri'    => "%" . $_GET['dat_pri'] . "%", 
				':kol_ost'     => "%" . $_GET['kol_ost'] . "%", 
				':st_ost'     => "%" . $_GET['st_ost'] . "%", 
				':sr_isp'     => "%" . $_GET['sr_isp'] . "%", 
				':dat_spis'     => "%" . $_GET['dat_spis'] . "%", 
				':kod_tov'     => "%" . $_GET['kod_tov'] . "%" 
			 ); 
			 $query = "SELECT * FROM spec_odj WHERE firm LIKE :firm AND sotr LIKE :sotr AND tovar LIKE :tovar AND dat_pri LIKE :dat_pri AND kol_ost LIKE :kol_ost AND st_ost LIKE :st_ost AND sr_isp LIKE :sr_isp and dat_spis LIKE :dat_spis AND kod_tov like :kod_tov"; //sr_isp LIKE :sr_isp and dat_spis LIKE :dat_spis AND kod_tov like :kod_tov 
 
			 $statement = $connect->prepare($query); 
			 $statement->execute($data); 
			 $result = $statement->fetchAll(); 
			 foreach($result as $row) 
			 { 
				$output[] = array( 
				 'firm'    => $row['firm'], 
				 'sotr'  => $row['sotr'], 
				 'tovar'   => $row['tovar'], 
				 'dat_pri'    => $row['dat_pri'], 
				 'kol_ost'   => $row['kol_ost'], 
				 'st_ost'   => $row['st_ost'], 
				 'sr_isp'   => $row['sr_isp'], 
				 'dat_spis'   => $row['dat_spis'], 
				 'kod_tov'   => $row['kod_tov'] 
				); 
			 } 
			 header("Content-Type: application/json"); 
			 echo json_encode($output); 
			 } 
				 		return view('spec_od/list',$output) ; 
	  } 
	public function postIndex() 
 	{ 
 
 
 
 		return view('spec_od/list') ; 
 	} 
 
 
 
}

И собственно роут routes.php

Route::get('spec_od','SpecController@getList');

Лог ошибок:

[2020-01-17 08:47:14] local.ERROR: exception 'ErrorException' with message 'Undefined index: firm' in D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\app\Http\Controllers\SpecController.php:38
Stack trace:
#0 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\app\Http\Controllers\SpecController.php(38): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined index...', 'D:\\Bitnami\\wapp...', 38, Array)
#1 [internal function]: App\Http\Controllers\SpecController->getList()
#2 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8230): call_user_func_array(Array, Array)
#3 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8297): Illuminate\Routing\Controller->callAction('getList', Array)
#4 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8276): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\SpecController), Object(Illuminate\Routing\Route), 'getList')
#5 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#6 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8895): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#7 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#8 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8878): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#9 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8277): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#10 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8263): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\SpecController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'getList')
#11 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(7260): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\\Http\\Contro...', 'getList')
#12 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(7231): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#13 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(6897): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#14 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8895): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#16 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8878): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#18 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(6898): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#19 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(6887): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#20 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(6872): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#21 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(1901): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#22 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#23 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8895): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#24 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\app\Http\Middleware\VerifyCsrfToken.php(17): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8887): App\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(12022): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8887): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(10728): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8887): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(11728): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8887): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(11677): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8887): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(2440): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8887): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(8878): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#38 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(1879): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#39 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\storage\framework\compiled.php(1868): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#40 D:\Bitnami\wappstack-5.4.38-0\frameworks\laravel\public\index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#41 {main}  
READ ALSO
Подскажите в переборе массива php

Подскажите в переборе массива php

Как перебрать массив следующего типа?

100
Как включить ЧПУ в компоненте news.list битрикс

Как включить ЧПУ в компоненте news.list битрикс

На сайте есть папка inform в ней 2 файла indexphp и detail

102
Как проверить изменения в диске

Как проверить изменения в диске

Пишу веб приложение на PHP, возника задача синхронизировать яндекс диск с сервером с помощью Rest Api, но вот как сделать если я загружаю файл...

95