Laravel Closure Function is not working (with) relation

Hello Developers I hope you are all good. I have had a problem for 2 or 3 days, and I can’t figure out how to solve this. The code is below here. but it always returns Error: Method name must be a string in file /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php on line 764 $feeds = Feed::where("id",$request->feed_id) ->with("media","likes","customer",[‘comments’=>function($query){ foreach ($query… Read More Laravel Closure Function is not working (with) relation

how to specify data on pearson correlation heatmap?

I have a pearson correlation heat map coded, but its showing data from my dataframe which i dont need. is there a way to specify which columns i’d like to include? thanks in advance sb.heatmap(df[‘POPDEN’, ‘RoadsArea’, ‘MedianIncome’, ‘MedianPrice’, ‘PropertyCount’, ‘AvPTAI2015’, ‘PTAL’].corr(), annot=True, fmt=’.2f’) ————————————————————————— TypeError Traceback (most recent call last) <ipython-input-54-832fc3c86e3e> in <module> —-> 1… Read More how to specify data on pearson correlation heatmap?

What is the relationship between the product function and the concept of permutations with repetitions?

from itertools import permutations,product,combinations_with_replacement colours = [‘r’,’g’,’b’] y = list(product(colours,repeat =2 )) x = list(combinations_with_replacement(colours,2)) print(y) print(x) I understand permutation of a set of objects is an ordering of those objects. When some of those objects are identical, the situation is transformed into permutations with repetition. >Solution : This may provide some insight: colours =… Read More What is the relationship between the product function and the concept of permutations with repetitions?

Attempt to read property id on bool in Laravel

i tried assigning a value to a variable in an if condition if ($hotel = Hotel::whereCode($this->hotelCode)->first() && $room = Room::whereRoomCode($value)->first()) { if ($hotel->room_id == $room->id) { return true; } } I get this error Attempt to read property "room_id" on bool meanwhile $hotel variable is not a boolean >Solution : Your code can be processed… Read More Attempt to read property id on bool in Laravel

Laravel Getting id's from a table and inserting them into another table

Trying to get matching id’s from a table and inserting them again in the same table under differnet relationship. $contentPack = ContentPack::find($id); $cloned_pack_goals = DB::table(‘content_pack_goal’)->where(‘content_pack_id’ , $contentPack->id)->get(); $cloned_pack_goal_ids = $cloned_pack_goals->goal_id; Produces Exception Exception Property [goal_id] does not exist on this collection instance. dd($cloned_pack_goals); outputs: Illuminate\Support\Collection {#2466 ▼ #items: array:2 [▼ 0 => {#3129 ▼ +"goal_id":… Read More Laravel Getting id's from a table and inserting them into another table

Prisma – create Post with N amount of Categories (explicit Many-to-Many)

I have the most basic explicit Many-to-Many relation: model Category { id Int @id @default(autoincrement()) title String @db.VarChar(24) posts PostCategory[] } model Post { id Int @id @default(autoincrement()) title String @db.VarChar(24) categories PostCategory[] } model PostCategory { category Category @relation(fields: [categoryId], references: [id]) categoryId Int post Post @relation(fields: [postId], references: [id]) postId Int @@id([categoryId, postId])… Read More Prisma – create Post with N amount of Categories (explicit Many-to-Many)