Skip to content

Commit 4f4f560

Browse files
v1.1.15
1 parent 94d571a commit 4f4f560

File tree

6 files changed

+42
-38
lines changed

6 files changed

+42
-38
lines changed

src/Http/Controllers/ActionableController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Andiwijaya\AppCore\Exceptions\KnownException;
66
use Illuminate\Http\Request;
77
use Illuminate\Routing\Controller as BaseController;
8+
use Illuminate\Support\Facades\View;
89
use function foo\func;
910

1011
class ActionableController extends BaseController{
@@ -61,5 +62,13 @@ public function onlyMethods($methods){
6162
return true;
6263
}
6364

65+
public function __construct()
66+
{
67+
View::share(get_object_vars($this));
68+
}
69+
70+
public function alertRequest(Request $request){
6471

72+
return htmlresponse()->alert(json_encode($request->all(), JSON_PRETTY_PRINT));
73+
}
6574
}

src/Models/ChatDiscussion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function sendGreeting(){
164164

165165
public function sendOfflineMessage(){
166166

167-
$offline_message_at = Carbon::createFromTimeString(date('Y-m-d H:i:s', strtotime($discussion->extra['offline_message_at'] ?? null)));
167+
$offline_message_at = Carbon::createFromTimeString(date('Y-m-d H:i:s', strtotime($this->extra['offline_message_at'] ?? null)));
168168

169169
if(config('chat.offline-message') && $offline_message_at->diffInHours() > 2){
170170

src/Models/Config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class Config extends Model
99
{
1010
use LoggedTraitV3;
1111

12+
public const NOTIFICATION_EMAIL = 1;
13+
public const NOTIFICATION_WHATSAPP = 2;
14+
1215
protected $table = 'config';
1316

1417
protected $fillable = [ 'key', 'value' ];

src/Responses/HTMLResponse.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function alert($text, $type = 'error', $options = []){
6565
$this->data[] = [
6666
'_type'=>'alert',
6767
'type'=>$type,
68-
'text'=>[ 'title'=>$title, 'description'=>$description ],
68+
'text'=>[ 'title'=>nl2br($title), 'description'=>$description ],
6969
'options'=>$options
7070
];
7171
return $this;
@@ -128,6 +128,27 @@ public function chart($target, $type, array $labels, array $data, array $options
128128
return $this;
129129
}
130130

131+
public function consoleError($text){
132+
133+
$this->data[] = [ '_type'=>'console.error', 'text'=>$text ];
134+
135+
return $this;
136+
}
137+
138+
public function consoleInfo($text){
139+
140+
$this->data[] = [ '_type'=>'console.info', 'text'=>$text ];
141+
142+
return $this;
143+
}
144+
145+
public function consoleWarn($text){
146+
147+
$this->data[] = [ '_type'=>'console.warn', 'text'=>$text ];
148+
149+
return $this;
150+
}
151+
131152
public function grid($target, $data, $columns, array $options = []){
132153

133154
$onitemclick = $options['onitemclick'] ?? '';

src/helpers.php

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ function is_assoc($array) {
1414
}
1515

1616
if (! function_exists('exc')) {
17-
function exc($message = '')
17+
function exc($message = '', $debug = false)
1818
{
19-
if(is_array($message)) $message = json_encode($message);
20-
throw new \Andiwijaya\AppCore\Exceptions\KnownException($message);
19+
$text = env('APP_DEBUG') && $debug != false ? $debug : $message;
20+
if(is_array($text)) $text = json_encode($text);
21+
22+
throw new \Andiwijaya\AppCore\Exceptions\KnownException(($debug != false ? $message . ' ' : '') . $text);
2123

2224
}
2325
}
@@ -823,39 +825,6 @@ function ceiling($number, $significance = 1)
823825
}
824826
}
825827

826-
if(!function_exists('rand_image')){
827-
828-
function rand_image($count = 1){
829-
830-
$image_urls = [
831-
'https://files.vlad.studio/sequoia/joy/sketchy_unfocused/thumbs/1024x1024.jpg',
832-
'https://files.vlad.studio/sequoia/joy/i_feel_good/thumbs/1024x1024.jpg',
833-
'https://files.vlad.studio/sequoia/joy/man_with_very_long_hand/thumbs/1024x1024.jpg',
834-
'https://files.vlad.studio/sequoia/joy/bookworm/thumbs/1024x1024.jpg',
835-
'https://files.vlad.studio/sequoia/joy/perfect_boobs/thumbs/1024x1024.jpg',
836-
'https://files.vlad.studio/sequoia/joy/sleeping_whales/thumbs/1024x1024.jpg',
837-
'https://files.vlad.studio/sequoia/joy/axolotl/thumbs/1024x1024.jpg',
838-
'https://files.vlad.studio/sequoia/joy/hug/thumbs/1024x1024.jpg',
839-
'https://files.vlad.studio/sequoia/joy/bird_bird_bird_bird_bird/thumbs/1024x1024.jpg',
840-
'https://files.vlad.studio/sequoia/joy/still/thumbs/1024x1024.jpg',
841-
'https://files.vlad.studio/sequoia/joy/blank_canvas/thumbs/1024x1024.jpg',
842-
'https://files.vlad.studio/sequoia/joy/xmas_windows/thumbs/1024x1024.jpg',
843-
'https://files.vlad.studio/sequoia/joy/early_morning/thumbs/1024x1024.jpg',
844-
'https://files.vlad.studio/sequoia/joy/coffee_station/thumbs/1024x1024.jpg',
845-
'https://files.vlad.studio/sequoia/joy/lower_antelope_2/thumbs/1024x1024.jpg',
846-
'https://files.vlad.studio/sequoia/joy/tinyliving/thumbs/1024x1024.jpg',
847-
'https://files.vlad.studio/sequoia/joy/starry_night/thumbs/1024x1024.jpg',
848-
'https://files.vlad.studio/sequoia/joy/bat_and_her_pet/thumbs/1024x1024.jpg',
849-
'https://files.vlad.studio/sequoia/joy/cats/thumbs/1024x1024.jpg'
850-
];
851-
852-
if($count == 1) return $image_urls[rand(0, count($image_urls) - 1)];
853-
return array_splice($image_urls, 0, $count);
854-
855-
}
856-
857-
}
858-
859828
if(!function_exists('random_dark_color')){
860829

861830
function random_dark_color() {

src/views/sections/cms-import-columns.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353
</div>
5454

55+
@yield('columns-ext')
56+
5557
</div>
5658

5759
<div class="foot pad-2 align-right">

0 commit comments

Comments
 (0)