PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 7, 2022

[FIXED] Is there any way to bypass using database in Laravel

 March 07, 2022     laravel, laravel-5, laravel-6, laravel-7     No comments   

Issue

I'm using Laravel version 7.x where having trouble to access a property value inside my view template. It's showing the following exception:

Trying to get property 'image_name' of non-object (View: F:\Laravel\doorsoft_job_assignment\resources\views\images\image-list.blade.php)

And showing me solution:

Database name seems incorrect You're using the default database name laravel. This database does not exist. Edit the .env file and use the correct database name in the DB_DATABASE key.

I have attached the exception & solution to have a more clear view as image.

Here is the image

Anyway, I'm passing data to view from a .json file. Where array of objects contains on that .json file. I'm returning data from that file instead of via Model. I don't want to use Database for CRUD

Note: I have already searched similar problem and found something to set DB_DATABASE = unused to fix the problem from this answer but that solution not fixed my problem.

Can anyone help me? Thank you in advanced.


Solution

I have solved the issue. In my view file, by writing $img['image_name'] instead of writing $img->image_name has solved the issue for me.



Answered By - Rashed Rahat
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing