Category "laravel-5"

Get all the products which are inside parent Category and child categories in Laravel with the help of relation

I have category and product table as follows: Categories: id | name | slug | parent_id Products : id | brand_id | name | slug | price | desc P

syntax error, unexpected '​' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) Laravel

I have a shop model you can see it <?php namespace App; use Illuminate\Database\Eloquent\Model; use TCG\Voyager\Traits\Spatial; class Shop extends Mode

Laravel eloquent query with filter "where ILIKE" does not match with any value with accent saved in my Postgre database (encoded in UTF8)

I have a Laravel 5.8 app. It works with a Postgres Database encoded with UTF8. I have a query for my users table, so i made my query as: $users = User::where

how to use whereHas in laravel

I am new to laravel, I need to create a query for the db, $query = Deal::query(); I want to use the wherehas operator. this is my code that is worked. else if

how to get name from url dynamically

How to get a part of the url? query to be made: $name = 'LeSant'; // (from url dinamic) // $event = Dias::where('name', $name)->first(); How can I get name

yield inside section in Laravel 8

I am trying to yield a section inside another section which is itself yielded in master.blade.php, but it does not work. master.blade.php <!DOCTYPE html>

How to get array values using foreach in laravel

I am new to laravel and php. I have this code in one of my controllers: $group_by_precedence = array("true", "false"); And this code in the view: @foreach ($gr

Is it possible to change the table name in the migration file-laravel

I created a migration file using php artisan make:migration create_todoapps_table. The migration file was created with the table name as to_do_apps (Schem

Laravel print last executed SQL query with Query log

DB::enableQueryLog(); $mines = Cranks::where([['crank_id', '=', $this->crank_id], ['mine_id', 'like', '%'.$script_value->mine_id.'%'] ])->get(); $query

With html2pdf in generated pdf as all css styles are lost

In my laravel 5.7 / bootstrap 4.4 app I use spatie/browsershot 3.37 and spipu/html2pdf 5.2 to generate pdf file and for my generated pdf file want I set layout

Laravel installer throws error when creating new project

I am trying to create new Laravel application. I have installed XAMPP and Composer. With Composer ( composer global require laravel/installer ) I have installed

Get name of Language instead of Locale name (in Laravel)?

How do I fetch name of locale (language) not just a locale string, but rather the name of that language in LARAVEL? {{ app()->getLocale() }}

Laravel MSSQL Server Connection not working

Laravel version:7.13, SqlServer:2019 SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: An existing connection was forcibly closed by

How to stop the GET method is not supported for this route from showing?

I have a working Laravel project with loads of different routes. I'm currently testing it and one of my tests was to check if a user were to use a delete or pos

What will the best solution for this multiple optional filter?

These are all optional fields, so will I have to write multiple queries with conditions or is there any way to handle this using Laravel? What will be the query

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

I moved my project from desk to another. When I run php artisan it does not work. I tried to run composer update, but it returns the error Script @php a

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

I am working on Razorpay integration and after succesful payment when I try to save the details to the database I get an error. I am sending t

How to order by eager loaded relationship in Laravel 5.5?

The code below works perfectly and displays all products with discounts in JSON Format for my API. But I want the result ordered by id in the discounts table. S

Fresh Laravel install deletes server.php on artisan serve

I'm a bit fresh to Laravel. I installed it via composer in the xampp/htdocs file. I installed the latest version 5.6. The install works with no errors, and the

Failed when put cache to file in laravel

When i run Cache::put('max_age','100',60)); Then the error said that file_put_contents(storage/framework/cache/data/8f/87/8f87426f74633c0fa8f717150f13e8fc04