Viewing File: /home/ubuntu/vedadeals-backend-base/database/factories/BellNotificationFactory.php
<?php
namespace Database\Factories;
use App\Models\{Product, Order};
use Illuminate\Database\Eloquent\Factories\Factory;
class BellNotificationFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$actions = [BELL_NOTIFICATION_ORDER, BELL_NOTIFICATION_PRODUCT];
$action = $actions[rand(0, 1)];
if($action == BELL_NOTIFICATION_PRODUCT) {
$model = Product::find(rand(1, 20));
} else {
$model = Order::find(rand(1, 20));
}
return [
'title' => 'PoshMarkets',
'description' => $this->faker->text(10, 15),
'to_user_id' => rand(1, 10),
'action' => $actions[rand(0, 1)],
'model_unique_id' => $model->unique_id ?? '',
];
}
}
Back to Directory
File Manager