Skip to main content

Posts

How to create remove and add more inputs functionality with input type file and text in Laravel?

Create remove and add more inputs functionality with input type file and text in Laravel Blade file code       <form action="{{ route('storeDocuments') }}" method="post" enctype="multipart/form-data">         @csrf         <div id="inputFields">             @if(!empty($documents[0]))             @php $counter = 1000; @endphp                 @foreach($documents as $document)                     <input type="hidden" id="document_id" name="documents[{{$counter}}][document_id]" value="{{$document->id}}">                     <div class="field">                         <label for="title">Title:</label>             ...
Recent posts

How to show shape file (.shp)(map) on map with shape file?

Show shape file (.shp)(map) on map with shape file Include gasparesganga package in php code https://gasparesganga.com/labs/php-shapefile/ <?php // Register autoloader require_once('vendor/gasparesganga/php-shapefile/src/Shapefile/ShapefileAutoloader.php'); Shapefile\ShapefileAutoloader::register(); // Import classes use Shapefile\Shapefile; use Shapefile\ShapefileException; use Shapefile\ShapefileReader; try {     // Open Shapefile     $Shapefile = new ShapefileReader('filepath/shapefile.shp');         // $json_data = $Shapefile->fetchRecord()->getGeoJSON();     $geoJsonArray = [];     while ($Geometry = $Shapefile->fetchRecord()) {         // Skip the record if marked as "deleted"         if ($Geometry->isDeleted()) {             continue;         }                  ...

How to check date format in PHP?

Check date format in PHP function isCorrectDateFromat($date){     if(!empty($date)){         $dateString = $date; // Replace this with your date string         $format = "Y-m-d"; // Replace this with your expected date format         $dateTime = DateTime::createFromFormat($format, $dateString);         if ($dateTime === false) { /*             echo "The date is not in the correct format."; */         } else {             $errors = DateTime::getLastErrors();             if (empty($errors)) { /*                 echo "The date is in the correct format."; */                 return true;             } else { /*                 echo "...

How to delete previous image on update new image or delete record in laravel?

Delete previous image on update new image or delete record in laravel Laravel Model public function getProfileImageAttribute($profile_image)     {         if(!empty($profile_image))         {             return $filepath = URL::to('/') . '/public/upload/' . $profile_image;         }     }     // Custom method to get the original unmodified URL     public function getOriginalProfileImageAttribute()     {         return $this->attributes['profile_image'];     }     function deleteProfileImage(){         $model = $this;         // Check if the avatar attribute is changing         if ($model->isDirty('profile_image')) {             // Delete the previous profile image if it exists           ...

How to integrate one signal push notification in website (Laravel)?

Integrate one signal push notification     < script src = "https://cdn.onesignal.com/sdks/OneSignalSDK.js" async = "" ></ script >     < script >     var OneSignal = window . OneSignal || [];         var initConfig = {             appId: "{{ env('OneSignalApp_ID') }}" ,             notifyButton: {                 enable: true             },         };         OneSignal . push ( function () {             OneSignal . init ( initConfig );             console . log ( OneSignal );         });         OneSignal . push ( function () { /*             OneSignal.isPushNotificationsEnabled(function(isEnabled) {     ...

How to integrate pubnub chat in website?

Integrate pubnub chat   <script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script> <script src="https://cdn.pubnub.com/sdk/javascript/pubnub.7.2.3.min.js"></script> <style> .user_pubnub_mgs {     height: 450px;     border: 1px solid #d0d0d0;     padding: 10px 12px;     overflow-y: auto; } .other_user_chat {     background: #b4b4b4;     margin-bottom: 10px;     padding: 10px;     width: fit-content;     font-size: 14px;     border-radius: 10px 0px 10px 10px;     color: #fff;     display: block;     word-break: break-word; } .current_user_chat {     background: #2695ee;     margin-bottom: 10px;     padding: 10px;     width: fit-content;     font-size: 14px;     border-radi...

How to create load more on scroll functionality in laravel?

Create load more on scroll functionality in laravel Main listing file <style> .notifications_page_cover_ui {     overflow: auto;     max-height: 474px; } </style> <div class="ps-section__right">     <div class="section-header">         <h3>Notifications</h3>     </div>     <div class="section-content">        <div class="notifications_page_cover_ui" id="load-more-container">         <?php echo $notification_list ?>        </div>     </div> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() {     let lastNotificationID = {!! $lastNotificationID !!}; // Pass the last item ID from your controller or view     let loading = false;     function loadMoreData() {   ...