S
S
Stilian Brizhatov2020-04-26 16:55:33
Laravel
Stilian Brizhatov, 2020-04-26 16:55:33

Why is information not being retrieved from the database?

Hello.
There is a request in which there are several conditions in which there are parameters and they have a value. The problem is that although the values ​​​​are transferred to the request itself (debugging), it generally displays emptiness. I don’t understand what this is connected with, although if you manually enter data into the request, it displays information from the database.
Here is the model method:

static public function _sql_all($namebrand,$routename)
    {
    $series = DB::table('device_series')
    ->join('model', 'model.id_device_series', '=', 'device_series.id_device_series')
    ->join('brands', 'model.id_brand', '=', 'brands.id_brand')
    ->join('category_device', 'brands.id_category_device', '=', 'category_device.id_category_device')
    ->select('device_series.id_device_series', 'device_series.name_series', 'device_series.img_series', 'category_device.id_category_device', 'category_device.name_category', 'category_device.routename', 'brands.id_brand', 'brands.name_brand')
    ->where()
    ->get();
    return $series;


Here is the controller method:
class SeriesController extends Controller
{
    public function seriesshow($namebrand,$routename){
                    return view('series.mainseries')->with([
                    "result" => device_series::_sql_all($namebrand,$routename)]);
                }
}


What happened when debugging the request:
"select `device_series`.`id_device_series`, `device_series`.`name_series`, `device_series`.`img_series`, `category_device`.`id_category_device`, `category_device`.`name_category`, `category_device`.`routename`, `brands`.`id_brand`, `brands`.`name_brand` from `device_series` inner join `model` on `model`.`id_device_series` = `device_series`.`id_device_series` inner join `brands` on `model`.`id_brand` = `brands`.`id_brand` inner join `category_device` on `brands`.`id_category_device` = `category_device`.`id_category_device` where (`brands`.`name_brand` = ? and `category_device`.`routename` = ?)


What happened when debugging the parameters themselves passed to the request:
array:2 [▼
  0 => "smartphones"
  1 => "Samsung"
]

As you can see, there is a value, but I don’t understand why the page is empty?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stilian Brizhatov, 2020-04-27
@ST1LMAN

Topic closed.
I substituted values ​​through methods in the request, filtered it and everything worked.

K
Konstantin B., 2020-04-26
@Kostik_1993

Where did this "{$namebrand}"come from?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question