Undefined variable Laravel (strange case)

I am m having this annoying problem. Can anyone give a hand to sort out it? I read all posts and I cannot find the solution. This is my controller <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Auth; use DB; use App\Post; use App\RegisteredCourse; class DashboardsController extends Controller { public function indexA() { return view(‘dashboards.admin-dashboard’); }…

Discover more

orderBy on hasMany relationship laravel

I made a “hasMany” relationship from Category model to Product model using ProductCatRel model. I am trying to ordering my products form Category model. The “where” condition is fine, But “orderBy” is not working. Here is my code: public function Products(){ return $this->hasMany(ProductCatRel::class,’category’) ->with(‘Product’) ->whereHas(‘Product’, function($q){ $q->where(‘status’, 1)->orderBy(‘position’); }); }

Discover more

update session array value in laravel 6

i have a session with array value in laravel and i want to edit one array member when page is refresh my session like this $data = [ ‘product’ => $request->input(‘product’), ‘price’ => $request->input(‘price’), ‘quantity’ => 1 ]; $request->session()->put(‘cart_’. $request->input(‘id’) , $data); and i want to plus price value when page refreshed like this before…

Discover more

how to override storage class methods ‘Storage::has()’ and ‘Storage::get()’ in Laravel?

I need to extend the storage class methods so i can have my own definition of has() and get() methods, as i need to perform additional checks too, because when i use S3, the has() method errors out when thee connection is poor or has some other server related issue. class Storage extends \Illuminate\Filesystem\FilesystemManager {…

Discover more

How to handle the data received to save it in the database Laravel and Ajax?

I’m trying to add the product with multiple images to the database without refreshing the page, I don’t get any errors on console but I see the long text which starting like this <script> Sfdump = window.Sfdump || (function (doc) { var refStyle = doc.createElement(‘style’), rxEsc = /([.*+?^${}()|\[\]\/\\])/g, idRx = /\bsf-dump-\d+-ref[012]\w+\b/, keyHint = 0 <=…

Discover more

Why fontawesome icons in laravel does not showing?

I already install the fontawesome in my package.json “devDependencies”: { “@fortawesome/fontawesome-free”: “^5.11.2” , //etc. }, “dependencies”: { “font-awesome”: “^4.7.0” } and import it to my app.scss @import “~font-awesome/scss/font-awesome.scss”; I tried <i class=”fa fa-edit”></i> and <i class=”fas fa-edit”></i> but it just shows like this below, someone knows how to do this correctly?

Discover more

Why are not working laravel route method for specific number? What are the solution of this?

I have a school management project which created with laravel php framework. when i add subject number for class ‘Four’ or ‘Eight’ then i face a problem which is “Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message” But if i add number accept “four” or “eight” class then i have not face…

Discover more