@@ -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 | } |
@@ -89,10 +89,10 @@ |
||
89 | 89 | $campaignArr['id'] = $campaign->id; |
90 | 90 | $campaignArr['name']=$campaign->campaign_title; |
91 | 91 | if($campaign->campaign_active == 1){ |
92 | - $campaignArr['check']='checked'; |
|
92 | + $campaignArr['check']='checked'; |
|
93 | 93 | } |
94 | 94 | |
95 | - $campaignArr['time_start']=$campaign->campaign_configurations()->first() |
|
95 | + $campaignArr['time_start']=$campaign->campaign_configurations()->first() |
|
96 | 96 | ->time_start; |
97 | 97 | $dateStart = strtotime($campaignArr['time_start']); |
98 | 98 |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | //Модель работающая со страницами компании (создание новой и просмотр/редактирование выбранной) |
16 | 16 | class CampaignPageAdmin extends Model |
17 | 17 | { |
18 | - static public function getLangDefault(){ |
|
19 | - $campaign_lang = Doika_configuration::where('configuration_name','lang') |
|
18 | + static public function getLangDefault() { |
|
19 | + $campaign_lang = Doika_configuration::where('configuration_name', 'lang') |
|
20 | 20 | ->first()->configuration_value; |
21 | 21 | return $campaign_lang; |
22 | 22 | } |
23 | - static public function createCampaign($request){ |
|
23 | + static public function createCampaign($request) { |
|
24 | 24 | |
25 | 25 | // создание новой компании |
26 | 26 | $newCampaign = new Campaign; |
27 | 27 | $newCampaign->campaign_title = $request->title; |
28 | - if($request->campaign_active == "on"){ |
|
28 | + if ($request->campaign_active == "on") { |
|
29 | 29 | $newCampaign->campaign_active = 1; |
30 | - }else{ |
|
30 | + } else { |
|
31 | 31 | $newCampaign->campaign_active = 0; |
32 | 32 | } |
33 | 33 | |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | $newCampaignConfiguration = new Campaign_configuration; |
38 | 38 | $newCampaignConfiguration->campaign_id = $newCampaign->id; |
39 | 39 | |
40 | - if($request->campaign_progress_bar == "on"){ |
|
40 | + if ($request->campaign_progress_bar == "on") { |
|
41 | 41 | $newCampaignConfiguration->campaign_progress_bar = 1; |
42 | - }else{ |
|
42 | + } else { |
|
43 | 43 | $newCampaignConfiguration->campaign_progress_bar = 0; |
44 | 44 | } |
45 | 45 | |
46 | - if($request->hasFile('photo')){ |
|
46 | + if ($request->hasFile('photo')) { |
|
47 | 47 | $newCampaignConfiguration->photo = Uploader::upload($request); |
48 | - }else{ |
|
48 | + } else { |
|
49 | 49 | $newCampaignConfiguration->photo = 'default.jpg'; |
50 | 50 | } |
51 | 51 | $newCampaignConfiguration->required_amount = $request->required_amount; |
@@ -62,54 +62,54 @@ discard block |
||
62 | 62 | $newLangInformation->campaign_description_lang = $request->description; |
63 | 63 | |
64 | 64 | $newLangInformation->campaign_currency_lang = |
65 | - Doika_configuration::where('configuration_name','currency_lang') |
|
65 | + Doika_configuration::where('configuration_name', 'currency_lang') |
|
66 | 66 | ->first()->configuration_value; |
67 | 67 | $newLangInformation->required_amount_lang = |
68 | - Doika_configuration::where('configuration_name','required_amount_lang') |
|
68 | + Doika_configuration::where('configuration_name', 'required_amount_lang') |
|
69 | 69 | ->first()->configuration_value; |
70 | 70 | $newLangInformation->other_amount_lang = |
71 | - Doika_configuration::where('configuration_name','other_amount_lang') |
|
71 | + Doika_configuration::where('configuration_name', 'other_amount_lang') |
|
72 | 72 | ->first()->configuration_value; |
73 | 73 | $newLangInformation->donate_lang = |
74 | - Doika_configuration::where('configuration_name','donate_lang') |
|
74 | + Doika_configuration::where('configuration_name', 'donate_lang') |
|
75 | 75 | ->first()->configuration_value; |
76 | 76 | $newLangInformation->payment_title_lang = |
77 | - Doika_configuration::where('configuration_name','payment_title_lang') |
|
77 | + Doika_configuration::where('configuration_name', 'payment_title_lang') |
|
78 | 78 | ->first()->configuration_value; |
79 | 79 | $newLangInformation->payment_description_lang = |
80 | - Doika_configuration::where('configuration_name','payment_description_lang') |
|
80 | + Doika_configuration::where('configuration_name', 'payment_description_lang') |
|
81 | 81 | ->first()->configuration_value; |
82 | 82 | $newLangInformation->save(); |
83 | 83 | } |
84 | 84 | |
85 | - static public function getCampaignPage($id){ |
|
85 | + static public function getCampaignPage($id) { |
|
86 | 86 | |
87 | 87 | $campaign = Campaign::find($id); |
88 | - $campaignArr=[]; |
|
88 | + $campaignArr = []; |
|
89 | 89 | $campaignArr['id'] = $campaign->id; |
90 | - $campaignArr['name']=$campaign->campaign_title; |
|
91 | - if($campaign->campaign_active == 1){ |
|
92 | - $campaignArr['check']='checked'; |
|
90 | + $campaignArr['name'] = $campaign->campaign_title; |
|
91 | + if ($campaign->campaign_active == 1) { |
|
92 | + $campaignArr['check'] = 'checked'; |
|
93 | 93 | } |
94 | 94 | |
95 | - $campaignArr['time_start']=$campaign->campaign_configurations()->first() |
|
95 | + $campaignArr['time_start'] = $campaign->campaign_configurations()->first() |
|
96 | 96 | ->time_start; |
97 | 97 | $dateStart = strtotime($campaignArr['time_start']); |
98 | 98 | |
99 | - $campaignArr['time_start']= date('Y-m-d', strtotime($campaignArr['time_start'])); |
|
100 | - $campaignArr['time_end']= $campaign->campaign_configurations()->first() |
|
99 | + $campaignArr['time_start'] = date('Y-m-d', strtotime($campaignArr['time_start'])); |
|
100 | + $campaignArr['time_end'] = $campaign->campaign_configurations()->first() |
|
101 | 101 | ->time_end; |
102 | 102 | $dateEnd = strtotime($campaignArr['time_end']); |
103 | 103 | |
104 | - $campaignArr['time_end']= date('Y-m-d', strtotime($campaignArr['time_end'])); |
|
105 | - $campaignArr['campaign_progress_bar']=$campaign->campaign_configurations()->first() |
|
104 | + $campaignArr['time_end'] = date('Y-m-d', strtotime($campaignArr['time_end'])); |
|
105 | + $campaignArr['campaign_progress_bar'] = $campaign->campaign_configurations()->first() |
|
106 | 106 | ->campaign_progress_bar; |
107 | - $campaignArr['required_amount']=$campaign->campaign_configurations()->first() |
|
107 | + $campaignArr['required_amount'] = $campaign->campaign_configurations()->first() |
|
108 | 108 | ->required_amount; |
109 | - $campaignArr['photo']=$campaign->campaign_configurations()->first() |
|
109 | + $campaignArr['photo'] = $campaign->campaign_configurations()->first() |
|
110 | 110 | ->photo; |
111 | - $campaignArr['description']=$campaign->campaign_lang_informations() |
|
112 | - ->where('campaign_lang',self::getLangDefault()) |
|
111 | + $campaignArr['description'] = $campaign->campaign_lang_informations() |
|
112 | + ->where('campaign_lang', self::getLangDefault()) |
|
113 | 113 | ->first()->campaign_description_lang; |
114 | 114 | |
115 | 115 | |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | |
118 | 118 | $progress_start = round(($dateNow - $dateStart) / 86400); |
119 | 119 | $progress_end = round(($dateEnd - $dateStart) / 86400); |
120 | - $campaignArr['daysPassed'] = ($progress_start >= 0) ? $progress_start: 0; |
|
121 | - $campaignArr['daysToFinish'] = ($progress_end >= 0) ? $progress_end: 0; |
|
120 | + $campaignArr['daysPassed'] = ($progress_start >= 0) ? $progress_start : 0; |
|
121 | + $campaignArr['daysToFinish'] = ($progress_end >= 0) ? $progress_end : 0; |
|
122 | 122 | |
123 | 123 | |
124 | 124 | return $campaignArr; |
125 | 125 | |
126 | 126 | } |
127 | - static public function updateCampaignPage($id,$request){ |
|
127 | + static public function updateCampaignPage($id, $request) { |
|
128 | 128 | |
129 | 129 | // обновление данных компании |
130 | 130 | $Campaign = Campaign::find($id); |
131 | 131 | $Campaign->campaign_title = $request->title; |
132 | - if($request->campaign_active == "on"){ |
|
132 | + if ($request->campaign_active == "on") { |
|
133 | 133 | $Campaign->campaign_active = 1; |
134 | - }else{ |
|
134 | + } else { |
|
135 | 135 | $Campaign->campaign_active = 0; |
136 | 136 | } |
137 | 137 | $Campaign->save(); |
138 | 138 | |
139 | 139 | // обновление конфигурации компании |
140 | 140 | $CampaignConfiguration = $Campaign->campaign_configurations()->first(); |
141 | - if($request->hasFile('photo')){ |
|
141 | + if ($request->hasFile('photo')) { |
|
142 | 142 | $CampaignConfiguration->photo = Uploader::upload($request); |
143 | 143 | } |
144 | 144 | $CampaignConfiguration->required_amount = $request->required_amount; |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | $CampaignConfiguration->save(); |
149 | 149 | |
150 | 150 | // обновление информации компании на языке по умолчанию |
151 | - $LangInformation = $Campaign->campaign_lang_informations()->where('campaign_lang',self::getLangDefault())->first(); |
|
151 | + $LangInformation = $Campaign->campaign_lang_informations()->where('campaign_lang', self::getLangDefault())->first(); |
|
152 | 152 | $LangInformation->campaign_title_lang = $request->title; |
153 | 153 | $LangInformation->campaign_description_lang = $request->description; |
154 | 154 | $LangInformation->save(); |
155 | 155 | |
156 | 156 | |
157 | 157 | } |
158 | - static public function deleteCampaign($id){ |
|
158 | + static public function deleteCampaign($id) { |
|
159 | 159 | $campaign = Campaign::find($id); |
160 | 160 | $campaign->campaign_configurations()->delete(); |
161 | 161 | $campaign->campaign_lang_informations()->delete(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $newCampaign->campaign_title = $request->title; |
28 | 28 | if($request->campaign_active == "on"){ |
29 | 29 | $newCampaign->campaign_active = 1; |
30 | - }else{ |
|
30 | + } else{ |
|
31 | 31 | $newCampaign->campaign_active = 0; |
32 | 32 | } |
33 | 33 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | |
40 | 40 | if($request->campaign_progress_bar == "on"){ |
41 | 41 | $newCampaignConfiguration->campaign_progress_bar = 1; |
42 | - }else{ |
|
42 | + } else{ |
|
43 | 43 | $newCampaignConfiguration->campaign_progress_bar = 0; |
44 | 44 | } |
45 | 45 | |
46 | 46 | if($request->hasFile('photo')){ |
47 | 47 | $newCampaignConfiguration->photo = Uploader::upload($request); |
48 | - }else{ |
|
48 | + } else{ |
|
49 | 49 | $newCampaignConfiguration->photo = 'default.jpg'; |
50 | 50 | } |
51 | 51 | $newCampaignConfiguration->required_amount = $request->required_amount; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $Campaign->campaign_title = $request->title; |
132 | 132 | if($request->campaign_active == "on"){ |
133 | 133 | $Campaign->campaign_active = 1; |
134 | - }else{ |
|
134 | + } else{ |
|
135 | 135 | $Campaign->campaign_active = 0; |
136 | 136 | } |
137 | 137 | $Campaign->save(); |
@@ -7,10 +7,10 @@ |
||
7 | 7 | class Campaign extends Model |
8 | 8 | { |
9 | 9 | // связь один-ко-многим где модель выступает ведущей |
10 | - public function payments(){ |
|
10 | + public function payments() { |
|
11 | 11 | return $this->hasMany('App\DoikaApp\Tables\Payment'); |
12 | 12 | } |
13 | - public function campaign_lang_informations(){ |
|
13 | + public function campaign_lang_informations() { |
|
14 | 14 | return $this->hasMany('App\DoikaApp\Tables\Campaign_lang_information'); |
15 | 15 | } |
16 | 16 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class CampaignLangInformation extends Model |
8 | 8 | { |
9 | 9 | //связи модели один-ко-многим в которых она является дочерней |
10 | - public function campaign(){ |
|
10 | + public function campaign() { |
|
11 | 11 | return $this->belongsTo('App\DoikaApp\Tables\Campaign'); |
12 | 12 | } |
13 | 13 | } |