Laravel $data is undefined error but i defineted it on fuctions - laravel-9

I have a data $data["dil1"]="Yasin"; and i added this data to title with #section('title'){{$dil1}} - Yönetim Paneli #endsection but i get this error message when i try to run codes: $dil1 is undefined
How can i fix it ? or what's the main problem ?
Thank you

Related

Cannot read properties of undefined (reading 'setOptions') error in vue markdown-editor

I use vue markdown-editor component and I'm getting this error
vue.runtime.esm.js:1897 TypeError: Cannot read properties of undefined (reading 'setOptions')
at o.initialize (markdown-editor.vue:70:1)
at o.mounted (markdown-editor.vue:43:1)
at rt (vue.runtime.esm.js:1863:57)
at Rn (vue.runtime.esm.js:4235:7)
at Object.insert (vue.runtime.esm.js:3158:7)
at Y (vue.runtime.esm.js:6390:28)
at o.__patch__ (vue.runtime.esm.js:6609:5)
at o.On.e._update (vue.runtime.esm.js:3963:19)
at o.r (vue.runtime.esm.js:4081:10)
at rr.get (vue.runtime.esm.js:4495:25)
my code looks like this
<markdown-editor class="med" :configs="configs" v-model="messagetemplate.message"></markdown-editor>
I don't know how to add setOptions parameter. Thank you for the help!
edit: in markdown-editor.vue file I found this line marked.setOptions({ sanitize: this.sanitize });

fill datatable with vueJS

i´m trayin to fill my data table with vueJS and all my data from DB. I´m usign this library:
https://jamesdordoy.github.io/laravel-vue-datatable
It´s ok if i use this in my controller:
User::all()
return response()->json($query);
and in my component:
<div class="">
<data-table :data="data" :columns="columns" #on-table-props-changed="reloadTable"></data-table>
</div>
this library contain method to sortBy, orderBy, search by name, etc... with this:
use JamesDordoy\LaravelVueDatatable\Http\Resources\DataTableCollectionResource;
public function index(Request $request)
{
$length = $request->input('length');
$sortBy = $request->input('column');
$orderBy = $request->input('dir');
$searchValue = $request->input('search');
$query = User::eloquentQuery($sortBy, $orderBy, $searchValue);
$data = $query->paginate($length);
return new DataTableCollectionResource($data);
}
but if i use this in my controller in laravel 8 returned me:
Call to undefined method App\Models\User::eloquentQuery()
i don´t know if this it means to use get(), all().
Also, if i´m not use this and i to do all search manually, for example:
if(isset($sortBy)){
$query = User::all()->sortBy($sortBy);
$data = $query->paginate($length);
}
return response()->json($query);
returned me that:
Method Illuminate\Database\Eloquent\Collection::paginate does not exist
if i removed paginate and return $query, return all my data en my web browser console in network tab, but my table it´s empty...
for back-end i´m using laravel-8
in my web browser console return this message:
Invalid prop: type check failed for prop "data". Expected Object, got Array
if i change :data in my component for :items error in web browser console disappear
i don´t understand that i´m doing wrong for in one case i can fill my table and in other not...
Thanks for read and help me
i resolve my question with this:
$query = \DB::table('users')->orderBy($sortBy, $order)->paginate(10);
with model i can´t

ERROR TypeError: Cannot read property 'project_name' of undefined - Angular 8

My ts code coding is,
this.api.getPay(this.donationId).subscribe(
data => {
this.paymentData = data;
this.paymentDetails = this.paymentData.donationDetails[0];
}
)
My html code is like
Project : <strong>{{paymentDetails.project_name}}</strong><br/>
Status: <strong>{{paymentDetails?.status}}</strong><br/>
Now project_name and Status details will be displayed. Console gets "ERROR TypeError: Cannot read property 'project_name' of undefined"
If I added "?" like
{{paymentDetails?.project_name}}
No Details displayed. But console not having any Error.
This same coding method works well in Angular 5/6.
Any special method for Angular 8 ???
MY console output in TS file is
{
project_name: "test",
status: "true"
}
Previous question is How to Display Values in Angular 8 Shows ERROR TypeError: Cannot read property 'project_name' of undefined
but solution not working
anyone know how to resolve ?
Everything seems good, check if your component doesn't have
changeDetection: ChangeDetectiongStrategy.OnPush
If so, remove it and put back the '?' in the html markup, and then add it back and do the change detection in the subscribe

i am getting an error on using tf.frompixels recently which i wasnt getting before. below is the code i am using

function preprocessImage(img) {
const tensor = tf.fromPixels(img)
.resizeNearestNeighbor([224, 224]);
const croppedTensor = cropImage(tensor);
const batchedTensor = croppedTensor.expandDims(0);
return batchedTensor.toFloat().div(tf.scalar(127)).sub(tf.scalar(1));
}
the error i am getting is that tf.fromPixels is not a function . i wasnt getting this error as of two weeks back but i am suddenly getting this error on running the same code.
It looks like tf.fromPixels() has been removed and its function taken over by tf.browser.fromPixels().
Source

Cannot read property 'backgroundColor' of undefined

When the function call below gets run it returns this error.
"Uncaught TypeError: Cannot read property 'backgroundColor' of
undefined" I am trying to change the background color of a class called
.jumbotron. I have tried everything I can thing of so far.
Could anyone tell me why this is happening?
clrElementJumbo("cornsilk");
function clrElementJumbo(scolor) {
var el = document.getElementsByClassName("jumbotron");
el.style.backgroundColor = scolor;
}
Try to replace the code
var el = document.getElementsByClassName("jumbotron");
with the following
var el=document.getElementsByClassName("jumbotron")[0];