Level 102
Can you please use dd to show us what $data hold just before inserting?
array_push($data,$rowdata);
dd($data);
FraudAlert::insert($data);
1 like
hii i have column like datatype is enum and also store multiple value like comma seperated so is it possible to store ?
here is my code i try but i cant find any solution
here is my migrations
public function up()
{
Schema::table('fraud_alerts', function (Blueprint $table) {
$table->enum('alert_for',['disposition','fraudalert'])->after('type')->nullable()->comment('Alert For');
});
}
here is my controller code
public function store(Request $request){
$requestData = $request->all();
foreach($requestData['email'] as $i => $list){
$data = array();
$all = ['fraudalert','disposition'];
$rowdata = array();
if(in_array("all",$requestData['email_alert_for'])){
$rowdata['alert_for'] = implode(',' , $all);
}else{
$rowdata['alert_for'] = $requestData['email_alert_for'];
}
array_push($data,$rowdata);
FraudAlert::insert($data);
}
}
i try but everytime store null value in alert_for column
Ah now I get your question. The answer is no. You cannot store more that one value in an ENUM column. Either save in a json column, or add another table for this data :)
Please or to participate in this conversation.