@@ -7,13 +7,13 @@ |
||
7 | 7 | class Campaign extends Model |
8 | 8 | { |
9 | 9 | |
10 | - public function campaign_configurations(){ |
|
10 | + public function campaign_configurations() { |
|
11 | 11 | return $this->hasMany('App\Campaign_configuration'); |
12 | 12 | } |
13 | - public function campaign_lang_informations(){ |
|
13 | + public function campaign_lang_informations() { |
|
14 | 14 | return $this->hasMany('App\Campaign_lang_information'); |
15 | 15 | } |
16 | - public function payments(){ |
|
16 | + public function payments() { |
|
17 | 17 | return $this->hasMany('App\Payment'); |
18 | 18 | } |
19 | 19 |
@@ -8,17 +8,17 @@ |
||
8 | 8 | use App\Model\Payment; |
9 | 9 | |
10 | 10 | class PaymentImplementation extends Model { |
11 | - static public function createPayment($request, $id) { |
|
11 | + static public function createPayment($request, $id) { |
|
12 | 12 | |
13 | 13 | $message = file_get_contents('php://input'); |
14 | 14 | $message = json_decode($message); |
15 | 15 | |
16 | 16 | if($message->transaction->status == "successful") { |
17 | - $payment = new Payment; |
|
18 | - $payment->campaign_id = $id; |
|
19 | - $payment->amount = $message->transaction->amount * 0.01; |
|
20 | - $payment->token_payment = $message->transaction->credit_card->token; |
|
21 | - $payment->save(); |
|
17 | + $payment = new Payment; |
|
18 | + $payment->campaign_id = $id; |
|
19 | + $payment->amount = $message->transaction->amount * 0.01; |
|
20 | + $payment->token_payment = $message->transaction->credit_card->token; |
|
21 | + $payment->save(); |
|
22 | + } |
|
22 | 23 | } |
23 | - } |
|
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $message = file_get_contents('php://input'); |
14 | 14 | $message = json_decode($message); |
15 | 15 | |
16 | - if($message->transaction->status == "successful") { |
|
16 | + if ($message->transaction->status == "successful") { |
|
17 | 17 | $payment = new Payment; |
18 | 18 | $payment->campaign_id = $id; |
19 | 19 | $payment->amount = $message->transaction->amount * 0.01; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class Campaign_configuration extends Model |
8 | 8 | { |
9 | - public function campaign(){ |
|
9 | + public function campaign() { |
|
10 | 10 | return $this->belongsTo('App\Model\Campaign'); |
11 | 11 | } |
12 | 12 | } |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | class Doika_configuration extends Model |
8 | 8 | { |
9 | - protected $table = 'configurations'; |
|
9 | + protected $table = 'configurations'; |
|
10 | 10 | } |
@@ -7,13 +7,13 @@ |
||
7 | 7 | class Uploader extends Model |
8 | 8 | { |
9 | 9 | // |
10 | - static public function upload($request){ |
|
11 | - if($request->isMethod('post')){ |
|
10 | + static public function upload($request) { |
|
11 | + if ($request->isMethod('post')) { |
|
12 | 12 | |
13 | - if($request->hasFile('photo')) { |
|
13 | + if ($request->hasFile('photo')) { |
|
14 | 14 | $file = $request->file('photo'); |
15 | 15 | $fileName = $file->getClientOriginalName(); |
16 | - $file->move(public_path() . '/images',$fileName); |
|
16 | + $file->move(public_path().'/images', $fileName); |
|
17 | 17 | return $fileName; |
18 | 18 | } |
19 | 19 | } |
@@ -20,32 +20,32 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | foreach ($campaigns as $campaign) { |
23 | - $Arr['title']=$campaign->campaign_title; |
|
24 | - $Arr['id']=$campaign->id; |
|
23 | + $Arr['title'] = $campaign->campaign_title; |
|
24 | + $Arr['id'] = $campaign->id; |
|
25 | 25 | if ($campaign->campaign_active) { |
26 | - $Arr['active']='On'; |
|
26 | + $Arr['active'] = 'On'; |
|
27 | 27 | } else { |
28 | - $Arr['active']='Off'; |
|
28 | + $Arr['active'] = 'Off'; |
|
29 | 29 | } |
30 | - $Arr['collected_amount']= $campaign->payments()->sum('amount'); |
|
31 | - $Arr['required_amount']=$campaign->campaign_configurations() |
|
30 | + $Arr['collected_amount'] = $campaign->payments()->sum('amount'); |
|
31 | + $Arr['required_amount'] = $campaign->campaign_configurations() |
|
32 | 32 | ->first()->required_amount; |
33 | - $Arr['count_payments']= $campaign->payments()->count(); |
|
34 | - $Arr['avg_payment']= $campaign->payments()->avg('amount'); |
|
33 | + $Arr['count_payments'] = $campaign->payments()->count(); |
|
34 | + $Arr['avg_payment'] = $campaign->payments()->avg('amount'); |
|
35 | 35 | |
36 | - $Arr['time_start']=$campaign->campaign_configurations() |
|
36 | + $Arr['time_start'] = $campaign->campaign_configurations() |
|
37 | 37 | ->first()->time_start; |
38 | - $Arr['time_start']= date('d.m.Y', strtotime($Arr['time_start'])); |
|
39 | - $Arr['time_end']=$campaign->campaign_configurations() |
|
38 | + $Arr['time_start'] = date('d.m.Y', strtotime($Arr['time_start'])); |
|
39 | + $Arr['time_end'] = $campaign->campaign_configurations() |
|
40 | 40 | ->first()->time_end; |
41 | - $Arr['time_end']=date('d.m.Y', strtotime($Arr['time_end'])); |
|
41 | + $Arr['time_end'] = date('d.m.Y', strtotime($Arr['time_end'])); |
|
42 | 42 | |
43 | 43 | $currentTime = time(); |
44 | 44 | $timeEnd = explode('.', $Arr['time_end']); |
45 | 45 | |
46 | 46 | $timeEnd = mktime(0, 0, 0, $timeEnd[1], $timeEnd[0], $timeEnd[2]); |
47 | - $timeToEnd = $timeEnd - $currentTime; |
|
48 | - $timeToEnd = round($timeToEnd/86400, 0, PHP_ROUND_HALF_UP); |
|
47 | + $timeToEnd = $timeEnd - $currentTime; |
|
48 | + $timeToEnd = round($timeToEnd / 86400, 0, PHP_ROUND_HALF_UP); |
|
49 | 49 | |
50 | 50 | if ($timeToEnd > 0) { |
51 | 51 | $Arr['time_to_end'] = $timeToEnd; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | foreach ($campaigns as $campaign) { |
74 | 74 | $timeEnd = $campaign->campaign_configurations() |
75 | 75 | ->first()->time_end; |
76 | - $timeToEnd = date('Ymd', strtotime($timeEnd)) - date('Ymd'); |
|
76 | + $timeToEnd = date('Ymd', strtotime($timeEnd)) - date('Ymd'); |
|
77 | 77 | if ($timeToEnd < 0) { |
78 | 78 | $campaignsIsEnded[] = $campaign; |
79 | 79 | } |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | use App\Model\PasswordChange; |
8 | 8 | |
9 | 9 | class ConfigurationPageAdmin extends Model { |
10 | - //получение одной конфигурации |
|
11 | - static public function getConfiguration($configurationName,$getString){ |
|
10 | + //получение одной конфигурации |
|
11 | + static public function getConfiguration($configurationName,$getString){ |
|
12 | 12 | $configuration = Doika_configuration::where('configuration_name',$configurationName) |
13 | - ->first(); |
|
13 | + ->first(); |
|
14 | 14 | if($configuration && $getString){ |
15 | - $configuration = $configuration->configuration_value; |
|
15 | + $configuration = $configuration->configuration_value; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | return $configuration; |
19 | 19 | |
20 | - } |
|
21 | - //создание или обновление одной конфигурации |
|
22 | - static public function createOrUpdateConfiguration($configurationName,$value){ |
|
20 | + } |
|
21 | + //создание или обновление одной конфигурации |
|
22 | + static public function createOrUpdateConfiguration($configurationName,$value){ |
|
23 | 23 | if(!$value){ |
24 | - $value = ""; |
|
24 | + $value = ""; |
|
25 | 25 | } |
26 | 26 | $configuration = self::getConfiguration($configurationName,false); |
27 | 27 | if($configuration){ |
28 | - $configuration->configuration_value = $value; |
|
29 | - $configuration->save(); |
|
28 | + $configuration->configuration_value = $value; |
|
29 | + $configuration->save(); |
|
30 | 30 | }else{ |
31 | - $configuration = new Doika_configuration; |
|
32 | - $configuration->configuration_name = $configurationName; |
|
33 | - $configuration->configuration_value = $value; |
|
34 | - $configuration->configuration_active = 1; |
|
35 | - $configuration->save(); |
|
31 | + $configuration = new Doika_configuration; |
|
32 | + $configuration->configuration_name = $configurationName; |
|
33 | + $configuration->configuration_value = $value; |
|
34 | + $configuration->configuration_active = 1; |
|
35 | + $configuration->save(); |
|
36 | + } |
|
36 | 37 | } |
37 | - } |
|
38 | 38 | |
39 | - static public function getConfigurations(){ |
|
39 | + static public function getConfigurations(){ |
|
40 | 40 | //создаем массив конфигураций |
41 | 41 | $configurations = []; |
42 | 42 | // получаем ключ если он существует |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | //Паказваць банэр? |
50 | 50 | if(self::getConfiguration('show_banner',true) == 1){ |
51 | - $configurations['show_banner'] = self::getConfiguration('show_banner',true); |
|
51 | + $configurations['show_banner'] = self::getConfiguration('show_banner',true); |
|
52 | 52 | } |
53 | 53 | //Колер фону банэра |
54 | 54 | $configurations['color_banner_background'] = self::getConfiguration('color_banner_background',true); |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | $configurations['color_module_buttons'] = self::getConfiguration('color_module_buttons',true); |
63 | 63 | |
64 | 64 | if(self::getConfiguration('is_test',true) == 1){ |
65 | - $configurations['test_payments'] = self::getConfiguration('is_test',true); |
|
65 | + $configurations['test_payments'] = self::getConfiguration('is_test',true); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // отдаем готовый массив с конфигурациями |
69 | 69 | return $configurations; |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - //обновляем конфигурации или записываем новые |
|
73 | - static public function createOrUpdateConfigurations($request){ |
|
72 | + //обновляем конфигурации или записываем новые |
|
73 | + static public function createOrUpdateConfigurations($request){ |
|
74 | 74 | |
75 | 75 | self::createOrUpdateConfiguration('token',$request->token); |
76 | 76 | self::createOrUpdateConfiguration('id_market',$request->id_market); |
77 | 77 | self::createOrUpdateConfiguration('key_market',$request->key_market); |
78 | 78 | |
79 | 79 | if($request->show_banner){ |
80 | - self::createOrUpdateConfiguration('show_banner',1); |
|
80 | + self::createOrUpdateConfiguration('show_banner',1); |
|
81 | 81 | }else{ |
82 | - self::createOrUpdateConfiguration('show_banner',0); |
|
82 | + self::createOrUpdateConfiguration('show_banner',0); |
|
83 | 83 | } |
84 | 84 | self::createOrUpdateConfiguration('color_banner_background',$request->color_banner_background); |
85 | 85 | self::createOrUpdateConfiguration('color_banner_help_background',$request->color_banner_help_background); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | self::createOrUpdateConfiguration('color_module_buttons',$request->color_module_buttons); |
89 | 89 | |
90 | 90 | if($request->test_payments){ |
91 | - self::createOrUpdateConfiguration('is_test',1); |
|
91 | + self::createOrUpdateConfiguration('is_test',1); |
|
92 | 92 | }else{ |
93 | - self::createOrUpdateConfiguration('is_test',0); |
|
93 | + self::createOrUpdateConfiguration('is_test',0); |
|
94 | 94 | } |
95 | 95 | PasswordChange::changeProfile($request); |
96 | - } |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | class ConfigurationPageAdmin extends Model { |
10 | 10 | //получение одной конфигурации |
11 | - static public function getConfiguration($configurationName,$getString){ |
|
12 | - $configuration = Doika_configuration::where('configuration_name',$configurationName) |
|
11 | + static public function getConfiguration($configurationName, $getString) { |
|
12 | + $configuration = Doika_configuration::where('configuration_name', $configurationName) |
|
13 | 13 | ->first(); |
14 | - if($configuration && $getString){ |
|
14 | + if ($configuration && $getString) { |
|
15 | 15 | $configuration = $configuration->configuration_value; |
16 | 16 | } |
17 | 17 | |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | |
20 | 20 | } |
21 | 21 | //создание или обновление одной конфигурации |
22 | - static public function createOrUpdateConfiguration($configurationName,$value){ |
|
23 | - if(!$value){ |
|
22 | + static public function createOrUpdateConfiguration($configurationName, $value) { |
|
23 | + if (!$value) { |
|
24 | 24 | $value = ""; |
25 | 25 | } |
26 | - $configuration = self::getConfiguration($configurationName,false); |
|
27 | - if($configuration){ |
|
26 | + $configuration = self::getConfiguration($configurationName, false); |
|
27 | + if ($configuration) { |
|
28 | 28 | $configuration->configuration_value = $value; |
29 | 29 | $configuration->save(); |
30 | - }else{ |
|
30 | + } else { |
|
31 | 31 | $configuration = new Doika_configuration; |
32 | 32 | $configuration->configuration_name = $configurationName; |
33 | 33 | $configuration->configuration_value = $value; |
@@ -36,33 +36,33 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - static public function getConfigurations(){ |
|
39 | + static public function getConfigurations() { |
|
40 | 40 | //создаем массив конфигураций |
41 | 41 | $configurations = []; |
42 | 42 | // получаем ключ если он существует |
43 | - $configurations['token'] = self::getConfiguration('token',true); |
|
43 | + $configurations['token'] = self::getConfiguration('token', true); |
|
44 | 44 | //получаем IdMarket |
45 | - $configurations['id_market'] = self::getConfiguration('id_market',true); |
|
45 | + $configurations['id_market'] = self::getConfiguration('id_market', true); |
|
46 | 46 | //получаем KeyMarket |
47 | - $configurations['key_market'] = self::getConfiguration('key_market',true); |
|
47 | + $configurations['key_market'] = self::getConfiguration('key_market', true); |
|
48 | 48 | |
49 | 49 | //Паказваць банэр? |
50 | - if(self::getConfiguration('show_banner',true) == 1){ |
|
51 | - $configurations['show_banner'] = self::getConfiguration('show_banner',true); |
|
50 | + if (self::getConfiguration('show_banner', true) == 1) { |
|
51 | + $configurations['show_banner'] = self::getConfiguration('show_banner', true); |
|
52 | 52 | } |
53 | 53 | //Колер фону банэра |
54 | - $configurations['color_banner_background'] = self::getConfiguration('color_banner_background',true); |
|
54 | + $configurations['color_banner_background'] = self::getConfiguration('color_banner_background', true); |
|
55 | 55 | //Колер кнопкі "Дапамагчы" |
56 | - $configurations['color_banner_help_background'] = self::getConfiguration('color_banner_help_background',true); |
|
56 | + $configurations['color_banner_help_background'] = self::getConfiguration('color_banner_help_background', true); |
|
57 | 57 | //Колер тэкста "Дапамагчы" |
58 | - $configurations['color_banner_help_text'] = self::getConfiguration('color_banner_help_text',true); |
|
58 | + $configurations['color_banner_help_text'] = self::getConfiguration('color_banner_help_text', true); |
|
59 | 59 | //Колер фона модуля |
60 | - $configurations['color_module_background'] = self::getConfiguration('color_module_background',true); |
|
60 | + $configurations['color_module_background'] = self::getConfiguration('color_module_background', true); |
|
61 | 61 | //Колер кнопак з сумамі |
62 | - $configurations['color_module_buttons'] = self::getConfiguration('color_module_buttons',true); |
|
62 | + $configurations['color_module_buttons'] = self::getConfiguration('color_module_buttons', true); |
|
63 | 63 | |
64 | - if(self::getConfiguration('is_test',true) == 1){ |
|
65 | - $configurations['test_payments'] = self::getConfiguration('is_test',true); |
|
64 | + if (self::getConfiguration('is_test', true) == 1) { |
|
65 | + $configurations['test_payments'] = self::getConfiguration('is_test', true); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // отдаем готовый массив с конфигурациями |
@@ -70,27 +70,27 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | //обновляем конфигурации или записываем новые |
73 | - static public function createOrUpdateConfigurations($request){ |
|
73 | + static public function createOrUpdateConfigurations($request) { |
|
74 | 74 | |
75 | - self::createOrUpdateConfiguration('token',$request->token); |
|
76 | - self::createOrUpdateConfiguration('id_market',$request->id_market); |
|
77 | - self::createOrUpdateConfiguration('key_market',$request->key_market); |
|
75 | + self::createOrUpdateConfiguration('token', $request->token); |
|
76 | + self::createOrUpdateConfiguration('id_market', $request->id_market); |
|
77 | + self::createOrUpdateConfiguration('key_market', $request->key_market); |
|
78 | 78 | |
79 | - if($request->show_banner){ |
|
80 | - self::createOrUpdateConfiguration('show_banner',1); |
|
81 | - }else{ |
|
82 | - self::createOrUpdateConfiguration('show_banner',0); |
|
79 | + if ($request->show_banner) { |
|
80 | + self::createOrUpdateConfiguration('show_banner', 1); |
|
81 | + } else { |
|
82 | + self::createOrUpdateConfiguration('show_banner', 0); |
|
83 | 83 | } |
84 | - self::createOrUpdateConfiguration('color_banner_background',$request->color_banner_background); |
|
85 | - self::createOrUpdateConfiguration('color_banner_help_background',$request->color_banner_help_background); |
|
86 | - self::createOrUpdateConfiguration('color_banner_help_text',$request->color_banner_help_text); |
|
87 | - self::createOrUpdateConfiguration('color_module_background',$request->color_module_background); |
|
88 | - self::createOrUpdateConfiguration('color_module_buttons',$request->color_module_buttons); |
|
84 | + self::createOrUpdateConfiguration('color_banner_background', $request->color_banner_background); |
|
85 | + self::createOrUpdateConfiguration('color_banner_help_background', $request->color_banner_help_background); |
|
86 | + self::createOrUpdateConfiguration('color_banner_help_text', $request->color_banner_help_text); |
|
87 | + self::createOrUpdateConfiguration('color_module_background', $request->color_module_background); |
|
88 | + self::createOrUpdateConfiguration('color_module_buttons', $request->color_module_buttons); |
|
89 | 89 | |
90 | - if($request->test_payments){ |
|
91 | - self::createOrUpdateConfiguration('is_test',1); |
|
92 | - }else{ |
|
93 | - self::createOrUpdateConfiguration('is_test',0); |
|
90 | + if ($request->test_payments) { |
|
91 | + self::createOrUpdateConfiguration('is_test', 1); |
|
92 | + } else { |
|
93 | + self::createOrUpdateConfiguration('is_test', 0); |
|
94 | 94 | } |
95 | 95 | PasswordChange::changeProfile($request); |
96 | 96 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if($configuration){ |
28 | 28 | $configuration->configuration_value = $value; |
29 | 29 | $configuration->save(); |
30 | - }else{ |
|
30 | + } else{ |
|
31 | 31 | $configuration = new Doika_configuration; |
32 | 32 | $configuration->configuration_name = $configurationName; |
33 | 33 | $configuration->configuration_value = $value; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | if($request->show_banner){ |
80 | 80 | self::createOrUpdateConfiguration('show_banner',1); |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | self::createOrUpdateConfiguration('show_banner',0); |
83 | 83 | } |
84 | 84 | self::createOrUpdateConfiguration('color_banner_background',$request->color_banner_background); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | if($request->test_payments){ |
91 | 91 | self::createOrUpdateConfiguration('is_test',1); |
92 | - }else{ |
|
92 | + } else{ |
|
93 | 93 | self::createOrUpdateConfiguration('is_test',0); |
94 | 94 | } |
95 | 95 | PasswordChange::changeProfile($request); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class Payment extends Model |
8 | 8 | { |
9 | - public function campaign(){ |
|
9 | + public function campaign() { |
|
10 | 10 | return $this->belongsTo('App\Model\Campaign'); |
11 | 11 | } |
12 | 12 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class Campaign_lang_information extends Model |
8 | 8 | { |
9 | - public function campaign(){ |
|
9 | + public function campaign() { |
|
10 | 10 | return $this->belongsTo('App\Model\Campaign'); |
11 | 11 | } |
12 | 12 | } |