This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function collectionToArray($collection) { | |
return $collection->map(function ($model) { | |
return modelToArray($model); | |
})->toArray(); | |
} | |
function modelToArray($model) { | |
$result = $model->toArray(); | |
foreach ($model->getRelations() as $relationName => $relationValue) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const collection = document.getElementsByClassName("the-niche-cat"); | |
const uniqueCollections = [...new Set(Array.from(collection, element => element.innerText))]; | |
for (const item of uniqueCollections) { | |
console.log(item); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create new project -> composer create-project laravel/laravel projectName | |
Check laravel version -> php artisan --version | |
Run Project -> php artisan serve | |
php artisan make:model Category -m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name="appointment_status" id="" class="form-control mb-10 <?= $row['status']==0?"bg-yellow":($row['status']==1?"bg-green":"bg-red");?> " onchange="location=this.value;"> | |
<option value="<?= base_url("admin/change_status/{$row['id']}/0");?>" <?= $row['status']==0?"selected":"" ;?>>Pending</option> | |
<option value="<?= base_url("admin/change_status/{$row['id']}/1");?>" <?= $row['status']==1?"selected":"" ;?>>Approved</option> | |
<option value="<?= base_url("admin/change_status/{$row['id']}/2");?>" <?= $row['status']==2?"selected":"" ;?>>Cancel</option> | |
</select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
@header('X-Robots-Tag: "none, noindex, nofollow, noarchive, nosnippet, noodp, notranslate, noimageindex"'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!function_exists('custom_date')){ | |
function custom_date(){ | |
$months = array("Jan" => "يناير", "Feb" => "فبراير", "Mar" => "مارس", "Apr" => "أبريل", "May" => "مايو", "Jun" => "يونيو", "Jul" => "يوليو", "Aug" => "أغسطس", "Sep" => "سبتمبر", "Oct" => "أكتوبر", "Nov" => "نوفمبر", "Dec" => "ديسمبر"); | |
$your_date = date('y-m-d'); // The Current Date | |
$en_month = date("M", strtotime($your_date)); | |
foreach ($months as $en => $ar) { | |
if ($en == $en_month) { $ar_month = $ar; } | |
} | |
$find = array ("Sat", "Sun", "Mon", "Tue", "Wed" , "Thu", "Fri"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="timer"></div> | |
<script> | |
let seconds = 30 | |
const timerInternval = setInterval(function () { | |
seconds-- | |
document.getElementById("timer").innerHTML = seconds | |
if (seconds <= 0) { | |
stopInterval(timerInternval) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$root_folder = $dir; | |
foreach (glob($root_folder . '/*') as $file) { | |
if(is_file($file)){ | |
unlink($file); //unlick if it is file; | |
$is_rootFolderFile = TRUE; | |
} | |
if(is_dir($file)): | |
foreach (glob($file . '/*') as $subfolder): |