I have a table called award with the following structure
Schema::create('award', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('image_url');
$table->tinyInteger('status')->default(1);
$table->unsignedBigInteger('created_by_id')->nullable();
$table->unsignedBigInteger('updated_by_id')->nullable();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
});
I am using the yajra datatable package to populate my datatable using
$awards = Award::where('status', 1);
return Datatables::of($awards)->make(true);
When I dd() this data in the controller , all columns have the correct data , but on the frontend,when I console.log() the same data , the image_url column shows null , I do not know why this is happerning , any help would be great .
EDIT
When I do
$awards = Award::where('status',1)->get();
dd($awards);
It shows the following result:
you can see the image_url contains a value but on the front end it shows null

Ii assume you use outside laravel folder path and try to call it.
Its not good when you save path outside your laravel folder. When you call img, root dir is in public folder, so when you try to
<img src="user1/documents/xxx.png">it mean you try to access img to public/user1/documents/xxx.png.just in case when you want to insert image
that code will help you to put your img inside public folder, so you can just call it
<img src="xxx.png">.