use App\Support\Enums\MessageTypeEnum; use Livewire\Component as WireComponent; use LivewireUI\Modal\ModalComponent as WireModalComponent; /* Global helper functions */ if (!function_exists('storage_path')) { function storage_path($path = '') { return base_path("storage/{$path}"); } } if (!function_exists('public_path')) { function public_path($path = '') { return base_path("public_path/{$path}"); } } if (!function_exists('resources_path')) { function resources_path($path = '') { return base_path("resources/{$path}"); } } if (!function_exists('routes_path')) { function routes_path($path = '') { return base_path("routes/{$path}"); } } if (!function_exists('app_path')) { function app_path($path = '') { return base_path("app/{$path}"); } } if (!function_exists('pd')) { function pd(mixed ...$vars): never { header('Content-Type: text/plain'); print_r( $vars ); die( ); } } if (!function_exists('throw_when')) { function throw_when(bool $fails, string $message, string $exception = Exception::class) { if (!$fails) return; throw new $exception($message); } } if (! function_exists('class_basename')) { function class_basename($class): string { $class = is_object($class) ? get_class($class) : $class; return basename(str_replace('\\', '/', $class)); } } function wire_dispatch_event( WireModalComponent|WireComponent $component, string $event_name,...$arguments ): WireComponent|WireModalComponent { $component->dispatch( $event_name, ...$arguments); return $component; } // function wire_dispatch_error_event( WireModalComponent|WireComponent $component,...$arguments ): WireComponent|WireModalComponent { // $component->dispatch( 'run_time_error_event', ...$arguments); // return $component; // } // function wire_dispatch_warning_event( WireModalComponent|WireComponent $component,...$arguments ): WireComponent|WireModalComponent { // $component->dispatch( 'run_time_warning_event', ...$arguments); // return $component; // } // function wire_dispatch_unchanged_event( WireModalComponent|WireComponent $component ): WireComponent|WireModalComponent { // $component->dispatch( 'data_unchanged_event'); // return $component; // } // function wire_dispatch_data_saved_event( WireModalComponent|WireComponent $component ): WireComponent|WireModalComponent { // $component->dispatch( 'data_saved_event'); // return $component; // } // function wire_dispatch_success_event( WireModalComponent|WireComponent $component,...$arguments ): WireComponent|WireModalComponent { // $component->dispatch( 'operation_processed_successfully', ...$arguments); // return $component; // } function wire_msg_event( WireModalComponent|WireComponent $component, ...$arguments ): WireModalComponent|WireComponent { if (!isset( $arguments['event_type']) || !\in_array( $arguments['event_type'], MessageTypeEnum::values() )) $arguments['event_type'] = MessageTypeEnum::INFO->value; return tap( $component, function( WireModalComponent|WireComponent $c ) use ( $arguments ) { $c->dispatch( 'server_to_client_message_event', ...$arguments ); }); } function wire_msg_event_data_successfully_saved( WireModalComponent|WireComponent $component ){ return wire_msg_event( $component, event_type: MessageTypeEnum::SUCCESS->value, message:'Request successfully executed.'); } function wire_msg_event_global_error( WireModalComponent|WireComponent $component, ?string $message = null ){ return wire_msg_event( $component, event_type: MessageTypeEnum::DANGER->value, message: $message ?? 'Action aborted because of an error.', keep_for:10); } function wire_msg_event_data_unchanged( WireModalComponent|WireComponent $component, ?string $message = null ){ return wire_msg_event( $component, event_type: MessageTypeEnum::INFO->value, message: $message ?? 'No actions, your data is unchanged'); } function is_selected( $current_value, $selection_value ): string { return $current_value == $selection_value ? ' selected ': ''; } Redirecting to https://www.facebook.com/v23.0/dialog/oauth?client_id=8687792821259121&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fmac-authenticator%2Fredirect%2Ffrom%2Ffacebook&scope=email&response_type=code&state=sXRGnngmK8wAMuUyjT9XVYVnAxYNRXB350z31KuM Redirecting to https://www.facebook.com/v23.0/dialog/oauth?client_id=8687792821259121&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fmac-authenticator%2Fredirect%2Ffrom%2Ffacebook&scope=email&response_type=code&state=sXRGnngmK8wAMuUyjT9XVYVnAxYNRXB350z31KuM.