public function buyProduct($id){
$product = Product::find($id);
$user = Auth::user();
if($user->id == $product->owner_user_id){
return 'You cant buy your product';
}
elseif($product->status_id == SOLD){
return 'This product is sold';
}
elseif ($user->balance < $product->price) {
return 'Not enough money';
}
else{
//some code
}
}
tasks: [{
name: 'Create app',
description1: 'Use smth to do this Use smth to do this Use smth to do this Use smth to do this Use smth to do this Use smth to do this Use smth to do this Use smth to do this',
time: '02.12.2021'
},
{
name: 'Fix bugs',
description1: 'Fix all bugs',
time: '02.12.2021'
},
] as TaskInterface[]
$a = new Processor("Intel",100,"Max",24);
$a->registerProduct($a);
$a1 = new Processor("Intel",100,"Max",24);
$a1->registerProduct($a1);
,$a = new Processor("Intel",100,"Max",24);
$a->registerProduct($a);
$a = new Processor("Intel",100,"Max",24);
$a->registerProduct($a);
и так в моделе
уже лучше?