瀏覽代碼

Indentation + commentaires modèle CreditForm / MailForm

dev
Guillaume Bourgeois 6 年之前
父節點
當前提交
0ac3984851
共有 2 個文件被更改,包括 19 次插入9 次删除
  1. +11
    -5
      backend/models/CreditForm.php
  2. +8
    -4
      backend/models/MailForm.php

+ 11
- 5
backend/models/CreditForm.php 查看文件

@@ -49,7 +49,8 @@ use common\helpers\Mail ;
/**
* ContactForm is the model behind the contact form.
*/
class CreditForm extends Model {
class CreditForm extends Model
{

public $id_user ;
public $id_user_action ;
@@ -63,7 +64,8 @@ class CreditForm extends Model {
/**
* @inheritdoc
*/
public function rules() {
public function rules()
{
return [
[['montant'], 'required'],
[['id_user', 'id_user_action', 'id_etablissement'], 'integer'],
@@ -76,7 +78,8 @@ class CreditForm extends Model {
/**
* @inheritdoc
*/
public function attributeLabels() {
public function attributeLabels()
{
return [
'id_user' => 'Utilisateur',
'id_user_action' => 'Utilisateur',
@@ -90,7 +93,11 @@ class CreditForm extends Model {
];
}
public function save() {
/**
* Enregistre un modèle CreditHistorique.
*/
public function save()
{
if ($this->validate()) {
$credit_historique = new CreditHistorique ;
$credit_historique->id_user = $this->id_user;
@@ -115,7 +122,6 @@ class CreditForm extends Model {
'credit_form' => $this
]) ;
}
}
}


+ 8
- 4
backend/models/MailForm.php 查看文件

@@ -44,7 +44,8 @@ use yii\base\Model;
/**
* ContactForm is the model behind the contact form.
*/
class MailForm extends Model {
class MailForm extends Model
{

public $subject;
public $body;
@@ -52,7 +53,8 @@ class MailForm extends Model {
/**
* @inheritdoc
*/
public function rules() {
public function rules()
{
return [
// name, email, subject and body are required
[['subject', 'body'], 'required', 'message' => 'Champs obligatoire'],
@@ -62,7 +64,8 @@ class MailForm extends Model {
/**
* @inheritdoc
*/
public function attributeLabels() {
public function attributeLabels()
{
return [
'subject' => 'Sujet',
'body' => 'Message',
@@ -75,7 +78,8 @@ class MailForm extends Model {
* @param string $email the target email address
* @return boolean whether the email was sent
*/
public function sendEmail($email) {
public function sendEmail($email)
{

return Yii::$app->mailer->compose()
->setTo($email)

Loading…
取消
儲存