public function deleteAction()
{
$siteId =$this->getSite();
$request = new Request();
$Id ="contactNo";
if ($request->isPost()) {
if ($request->isAjax()) {
//echo 'Request was made using POST and AJAX';
$request = new Request();
$Id = $request->getPost("contactNo");
}
}
if(empty($Id))
{
return;
}
$binddata =
[
'SiteId'=>$siteId,
'contactNo' => $Id
];
$Contact = Contact::findfirst(
[
'columns' => ['*'],
'conditions' =>'SiteId = :SiteId: and Id = :Id: ',
'bind' => $binddata
]
);
if( $Contact !=null)
{
$Contact->ExpireDate = date('Y-m-d H:i:s');
if (!$Contact->delete()) {
foreach ($Contact->getMessages() as $message) {
$this->flash->error('contact '.$message);
}
// echo 'Data saving is failed..!';
}
}
}
Help to fix my project.