repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/11.php
Chapter11/11.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ $sparseArray = []; $sparseArray[0][5] = 1; $sparseArray[1][0] = 1; $sparseArray[2][4] = 2; $sparseArray[3][2] = 2; $sparseArray[4][6] = 1; $sparseArray[5][7] = 2; $sparseArray[6][6] = 1; $sparseArray[7][1] = 1; function getSparseValue(array $array, int $i, int $j): int { if (isset($array[$i][$j])) return $array[$i][$j]; else return 0; } echo getSparseValue($sparseArray, 0, 2) . "\n"; echo getSparseValue($sparseArray, 7, 1) . "\n"; echo getSparseValue($sparseArray, 8, 8) . "\n";
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/9.php
Chapter11/9.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ define("N", 9); define("UNASSIGNED", 0); function SolveSudoku(array &$grid): bool { $row = $col = 0; if (!FindUnassignedLocation($grid, $row, $col)) return true; // success! no empty space for ($num = 1; $num <= N; $num++) { if (isSafe($grid, $row, $col, $num)) { $grid[$row][$col] = $num; // make tentative assignment if (SolveSudoku($grid)) return true; // return, if success// return, if success $grid[$row][$col] = UNASSIGNED; // failure, unmake & try again } } return false; // triggers backtracking } function FindUnassignedLocation(array &$grid, int &$row, int &$col): bool { for ($row = 0; $row < N; $row++) for ($col = 0; $col < N; $col++) if ($grid[$row][$col] == UNASSIGNED) return true; return false; } function UsedInRow(array &$grid, int $row, int $num): bool { return in_array($num, $grid[$row]); } function UsedInColumn(array &$grid, int $col, int $num): bool { return in_array($num, array_column($grid, $col)); } function UsedInBox(array &$grid, int $boxStartRow, int $boxStartCol, int $num):bool { for ($row = 0; $row < 3; $row++) for ($col = 0; $col < 3; $col++) if ($grid[$row + $boxStartRow][$col + $boxStartCol] == $num) return true; return false; } function isSafe(array $grid, int $row, int $col, int $num): bool { return !UsedInRow($grid, $row, $num) && !UsedInColumn($grid, $col, $num) && !UsedInBox($grid, $row - $row % 3, $col - $col % 3, $num); } /* A utility function to print grid */ function printGrid(array $grid) { foreach ($grid as $row) { echo implode("", $row) . "\n"; } } /* $str = []; $str[] = "123456780"; $str[] = "456780123"; $str[] = "780123456"; $str[] = "234567801"; $str[] = "567801234"; $str[] = "801234567"; $str[] = "345678012"; $str[] = "678012345"; $str[] = "012345678"; $grid = []; foreach($str as $row) $grid[] = str_split ($row); */ $grid = [ [0, 0, 7, 0, 3, 0, 8, 0, 0], [0, 0, 0, 2, 0, 5, 0, 0, 0], [4, 0, 0, 9, 0, 6, 0, 0, 1], [0, 4, 3, 0, 0, 0, 2, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 5], [0, 5, 8, 0, 0, 0, 6, 7, 0], [5, 0, 0, 1, 0, 8, 0, 0, 9], [0, 0, 0, 5, 0, 3, 0, 0, 0], [0, 0, 2, 0, 9, 0, 5, 0, 0] ]; if (SolveSudoku($grid) == true) printGrid($grid); else echo "No solution exists";
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/7.php
Chapter11/7.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function LCS(string $X, string $Y): int { $M = strlen($X); $N = strlen($Y); $L = []; for ($i = 0; $i <= $M; $i++) $L[$i][0] = 0; for ($j = 0; $j <= $N; $j++) $L[0][$j] = 0; for ($i = 0; $i <= $M; $i++) { for ($j = 0; $j <= $N; $j++) { if($i == 0 || $j == 0) $L[$i][$j] = 0; else if ($X[$i - 1] == $Y[$j - 1]) $L[$i][$j] = $L[$i - 1][$j - 1] + 1; else $L[$i][$j] = max($L[$i - 1][$j], $L[$i][$j - 1]); } } return $L[$M][$N]; } $X = "AGGTAB"; $Y = "GGTXAYB"; echo "LCS Length:".LCS( $X, $Y );
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/10.php
Chapter11/10.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function pearsonScore(array $reviews, string $person1, string $person2): float { $commonItems = array(); foreach ($reviews[$person1] as $restaurant1 => $rating) { foreach ($reviews[$person2] as $restaurant2 => $rating) { if ($restaurant1 == $restaurant2) { $commonItems[$restaurant1] = 1; } } } $n = count($commonItems); if ($n == 0) return 0.0; $sum1 = 0; $sum2 = 0; $sqrSum1 = 0; $sqrSum2 = 0; $pSum = 0; foreach ($commonItems as $restaurant => $common) { $sum1 += $reviews[$person1][$restaurant]; $sum2 += $reviews[$person2][$restaurant]; $sqrSum1 += $reviews[$person1][$restaurant] ** 2; $sqrSum2 += $reviews[$person2][$restaurant] ** 2; $pSum += $reviews[$person1][$restaurant] * $reviews[$person2][$restaurant]; } $num = $pSum - (($sum1 * $sum2) / $n); $den = sqrt(($sqrSum1 - (($sum1 ** 2) / $n)) * ($sqrSum2 - (($sum2 ** 2) / $n))); if ($den == 0) { $pearsonCorrelation = 0; } else { $pearsonCorrelation = $num / $den; } return (float) $pearsonCorrelation; } function similarReviewers(array $reviews, string $person, int $n): array { $scoresArray = []; foreach ($reviews as $reviewer => $restaurants) { if ($person != $reviewer) { $scoresArray[$reviewer] = pearsonScore($reviews, $person, $reviewer); } } arsort($scoresArray); return array_slice($scoresArray, 0, $n); } function getRecommendations(array $reviews, string $person): array { $calculation = []; foreach ($reviews as $reviewer => $restaurants) { $similarityScore = pearsonScore($reviews, $person, $reviewer); if ($person == $reviewer || $similarityScore <= 0) { continue; } foreach ($restaurants as $restaurant => $rating) { if (!array_key_exists($restaurant, $reviews[$person])) { if (!array_key_exists($restaurant, $calculation)) { $calculation[$restaurant] = []; $calculation[$restaurant]['Total'] = 0; $calculation[$restaurant]['SimilarityTotal'] = 0; } $calculation[$restaurant]['Total'] += $similarityScore * $rating; $calculation[$restaurant]['SimilarityTotal'] += $similarityScore; } } } $recommendations = []; foreach ($calculation as $restaurant => $values) { $recommendations[$restaurant] = $calculation[$restaurant]['Total'] / $calculation[$restaurant]['SimilarityTotal']; } arsort($recommendations); return $recommendations; } $reviews = []; $reviews['Adiyan'] = ["McDonalds" => 5, "KFC" => 5, "Pizza Hut" => 4.5, "Burger King" => 4.7, "American Burger" => 3.5, "Pizza Roma" => 2.5]; $reviews['Mikhael'] = ["McDonalds" => 3, "KFC" => 4, "Pizza Hut" => 3.5, "Burger King" => 4, "American Burger" => 4, "Jafran" => 4]; $reviews['Zayeed'] = ["McDonalds" => 5, "KFC" => 4, "Pizza Hut" => 2.5, "Burger King" => 4.5, "American Burger" => 3.5, "Sbarro" => 2]; $reviews['Arush'] = ["KFC" => 4.5, "Pizza Hut" => 3, "Burger King" => 4, "American Burger" => 3, "Jafran" => 2.5, "FFC" => 3.5]; $reviews['Tajwar'] = ["Burger King" => 3, "American Burger" => 2, "KFC" => 2.5, "Pizza Hut" => 3, "Pizza Roma" => 2.5, "FFC" => 3]; $reviews['Aayan'] = [ "KFC" => 5, "Pizza Hut" => 4, "Pizza Roma" => 4.5, "FFC" => 4]; $person1 = 'Adiyan'; $person2 = 'Arush'; $person3 = 'Mikhael'; echo 'The similarity score calculated with the Pearson Correlation between ' . $person1 . ' and ' . $person2 . ' is: ' . pearsonScore($reviews, $person1, $person2) . '\n'; echo 'The similarity score calculated with the Pearson Correlation between ' . $person2 . ' and ' . $person3 . ' is: ' . pearsonScore($reviews, $person2, $person3) . '\n'; print_r(similarReviewers($reviews, $person1, 2)); $person = 'Arush'; echo 'Restaurant recommendations for ' . $person . "\n"; $recommendations = getRecommendations($reviews, $person); foreach ($recommendations as $restaturant => $score) { echo $restaturant . " \n"; } echo '<br /><br />';
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/5.php
Chapter11/5.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function velocityMagnifier(array $jobs) { $n = count($jobs); usort($jobs, function($opt1, $opt2) { return $opt1['velocity'] < $opt2['velocity']; }); $dMax = max(array_column($jobs, "deadline")); $slot = array_fill(1, $dMax, -1); $filledTimeSlot = 0; for ($i = 0; $i < $n; $i++) { $k = min($dMax, $jobs[$i]['deadline']); while ($k >= 1) { if ($slot[$k] == -1) { $slot[$k] = $i; $filledTimeSlot++; break; } $k--; } if ($filledTimeSlot == $dMax) { break; } } echo("Stories to Complete: "); for ($i = 1; $i <= $dMax; $i++) { echo $jobs[$slot[$i]]['id']; if ($i < $dMax) { echo "\t"; } } $maxVelocity = 0; for ($i = 1; $i <= $dMax; $i++) { $maxVelocity += $jobs[$slot[$i]]['velocity']; } echo "\nMax Velocity: " . $maxVelocity; } $jobs = [ ["id" => "S1", "deadline" => 2, "velocity" => 95], ["id" => "S2", "deadline" => 1, "velocity" => 32], ["id" => "S3", "deadline" => 2, "velocity" => 47], ["id" => "S4", "deadline" => 1, "velocity" => 42], ["id" => "S5", "deadline" => 3, "velocity" => 28], ["id" => "S6", "deadline" => 4, "velocity" => 64] ]; velocityMagnifier($jobs);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/3.php
Chapter11/3.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function KMPStringMatching(string $str, string $pattern): array { $matches = []; $M = strlen($pattern); $N = strlen($str); $i = $j = 0; $lps = []; ComputeLPS($pattern, $lps); while ($i < $N) { if ($pattern[$j] == $str[$i]) { $j++; $i++; } if ($j == $M) { array_push($matches, $i - $j); $j = $lps[$j - 1]; } else if ($i < $N && $pattern[$j] != $str[$i]) { if ($j != 0) $j = $lps[$j - 1]; else $i = $i + 1; } } return $matches; } function ComputeLPS(string $pattern, array &$lps) { $len = 0; $i = 1; $M = strlen($pattern); $lps[0] = 0; while ($i < $M) { if ($pattern[$i] == $pattern[$len]) { $len++; $lps[$i] = $len; $i++; } else { if ($len != 0) { $len = $lps[$len - 1]; } else { $lps[$i] = 0; $i++; } } } } $txt = "AABAACAADAABABBBAABAA"; $pattern = "AABA"; $matches = KMPStringMatching($txt, $pattern); if ($matches) { foreach ($matches as $pos) { echo "Pattern found at index : " . $pos . "\n"; } }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/1.php
Chapter11/1.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ $startTime = microtime(); $count = 0; function fibonacci(int $n): int { global $count; $count++; if ($n == 0) { return 1; } else if ($n == 1) { return 1; } else { return fibonacci($n - 1) + fibonacci($n - 2); } } echo fibonacci(30) . "\n"; echo "Function called: " . $count . "\n"; $endTime = microtime(); echo "time =" . ($endTime - $startTime) . "\n"; $startTime = microtime(); $fibCache = []; $count = 0; function fibonacciMemoized(int $n): int { global $fibCache; global $count; $count++; if ($n == 0) { return 1; } else if ($n == 1) { return 1; } else { if (isset($fibCache[$n - 1])) { $tmp = $fibCache[$n - 1]; } else { $tmp = fibonacciMemoized($n - 1); $fibCache[$n - 1] = $tmp; } if (isset($fibCache[$n - 2])) { $tmp1 = $fibCache[$n - 2]; } else { $tmp1 = fibonacciMemoized($n - 2); $fibCache[$n - 2] = $tmp1; } return $tmp + $tmp1; } } echo fibonacciMemoized(30) . "\n"; echo "Function called: " . $count . "\n"; $endTime = microtime(); echo "time =" . ($endTime - $startTime) . "\n";
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter11/2.php
Chapter11/2.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function strFindAll(string $pattern, string $txt): array { $M = strlen($pattern); $N = strlen($txt); $positions = []; for ($i = 0; $i <= $N - $M; $i++) { for ($j = 0; $j < $M; $j++) if ($txt[$i + $j] != $pattern[$j]) break; if ($j == $M) $positions[] = $i; } return $positions; } $txt = "AABAACAADAABABBBAABAA"; $pattern = "AABA"; $matches = strFindAll($pattern, $txt); if ($matches) { foreach ($matches as $pos) { echo "Pattern found at index : " . $pos . "\n"; } }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter10/4.php
Chapter10/4.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ $numbers = [37, 44, 34, 65, 26, 86, 143, 129, 9]; $heap = new SplMaxHeap; foreach ($numbers as $number) { $heap->insert($number); } while (!$heap->isEmpty()) { echo $heap->extract() . "\t"; }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter10/3.php
Chapter10/3.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function heapSort(array &$a) { $length = count($a); buildHeap($a); $heapSize = $length - 1; for ($i = $heapSize; $i >= 0; $i--) { $tmp = $a[0]; $a[0] = $a[$heapSize]; $a[$heapSize] = $tmp; $heapSize--; heapify($a, 0, $heapSize); } } function buildHeap(array &$a) { $length = count($a); $heapSize = $length - 1; for ($i = ($length / 2); $i >= 0; $i--) { heapify($a, $i, $heapSize); } } function heapify(array &$a, int $i, int $heapSize) { $largest = $i; $l = 2 * $i + 1; $r = 2 * $i + 2; if ($l <= $heapSize && $a[$l] > $a[$i]) { $largest = $l; } if ($r <= $heapSize && $a[$r] > $a[$largest]) { $largest = $r; } if ($largest != $i) { $tmp = $a[$i]; $a[$i] = $a[$largest]; $a[$largest] = $tmp; heapify($a, $largest, $heapSize); } } $numbers = [37, 44, 34, 65, 26, 86, 143, 129, 9]; heapSort($numbers); echo implode("\t", $numbers);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter10/1.php
Chapter10/1.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ class MinHeap { public $heap; public $count; public function __construct(int $size) { $this->heap = array_fill(0, $size + 1, 0); $this->count = 0; } public function create(array $arr = []) { if ($arr) { foreach ($arr as $val) { $this->insert($val); } } } public function display() { echo implode("\t", array_slice($this->heap, 1)) . "\n"; } public function insert(int $i) { if ($this->count == 0) { $this->heap[1] = $i; $this->count = 2; } else { $this->heap[$this->count++] = $i; $this->siftUp(); } } public function siftUp() { $tmpPos = $this->count - 1; $tmp = intval($tmpPos / 2); while ($tmpPos > 0 && $this->heap[$tmp] > $this->heap[$tmpPos]) { $this->swap($tmpPos, $tmp); $tmpPos = intval($tmpPos / 2); $tmp = intval($tmpPos / 2); } } public function swap(int $a, int $b) { $tmp = $this->heap[$a]; $this->heap[$a] = $this->heap[$b]; $this->heap[$b] = $tmp; } public function extractMin() { $min = $this->heap[1]; $this->heap[1] = $this->heap[$this->count - 1]; $this->heap[--$this->count] = 0; $this->siftDown(1); return $min; } public function siftDown(int $k) { $smallest = $k; $left = 2 * $k; $right = 2 * $k + 1; if ($left < $this->count && $this->heap[$smallest] > $this->heap[$left]) { $smallest = $left; } if ($right < $this->count && $this->heap[$smallest] > $this->heap[$right]) { $smallest = $right; } if ($smallest != $k) { $this->swap($k, $smallest); $this->siftDown($smallest); } } } $numbers = [37, 44, 34, 65, 26, 86, 129, 83, 9]; echo "Initial array \n" . implode("\t", $numbers) . "\n"; $heap = new MinHeap(count($numbers)); $heap->create($numbers); echo "Constructed Heap\n"; $heap->display(); echo "Min Extract: " . $heap->extractMin() . "\n"; $heap->display(); echo "Min Extract: " . $heap->extractMin() . "\n"; $heap->display(); echo "Min Extract: " . $heap->extractMin() . "\n"; $heap->display(); echo "Min Extract: " . $heap->extractMin() . "\n"; $heap->display(); echo "Min Extract: " . $heap->extractMin() . "\n"; $heap->display(); echo "Min Extract: " . $heap->extractMin() . "\n"; $heap->display();
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter10/2.php
Chapter10/2.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ class MaxHeap { public $heap; public $count; public function __construct(int $size) { $this->heap = array_fill(0, $size, 0); $this->count = 0; } public function create(array $arr = []) { if ($arr) { foreach ($arr as $val) { $this->insert($val); } } } public function display() { echo implode("\t", array_slice($this->heap, 0)) . "\n"; } public function insert(int $i) { if ($this->count == 0) { $this->heap[0] = $i; $this->count = 1; } else { $this->heap[$this->count++] = $i; $this->siftUp(); } } public function siftUp() { $tmpPos = $this->count - 1; $tmp = intval($tmpPos / 2); while ($tmpPos > 0 && $this->heap[$tmp] < $this->heap[$tmpPos]) { $this->swap($tmpPos, $tmp); $tmpPos = intval($tmpPos / 2); $tmp = intval($tmpPos / 2); } } public function extractMax() { $min = $this->heap[0]; $this->heap[0] = $this->heap[$this->count - 1]; $this->heap[$this->count - 1] = 0; $this->count--; $this->siftDown(0); return $min; } public function siftDown(int $k) { $largest = $k; $left = 2 * $k + 1; $right = 2 * $k + 2; if ($left < $this->count && $this->heap[$largest] < $this->heap[$left]) { $largest = $left; } if ($right < $this->count && $this->heap[$largest] < $this->heap[$right]) { $largest = $right; } if ($largest != $k) { $this->swap($k, $largest); $this->siftDown($largest); } } public function swap(int $a, int $b) { $temp = $this->heap[$a]; $this->heap[$a] = $this->heap[$b]; $this->heap[$b] = $temp; } } class PriorityQ extends MaxHeap { public function __construct(int $size) { parent::__construct($size); } public function enqueue(int $val) { parent::insert($val); } public function dequeue() { return parent::extractMax(); } } $numbers = [37, 44, 34, 65, 26, 86, 129, 83, 9]; $pq = new PriorityQ(count($numbers)); foreach ($numbers as $number) { $pq->enqueue($number); } echo "Constructed Heap\n"; $pq->display(); echo "DeQueued: " . $pq->dequeue() . "\n"; $pq->display(); echo "DeQueued: " . $pq->dequeue() . "\n"; $pq->display(); echo "DeQueued: " . $pq->dequeue() . "\n"; $pq->display(); echo "DeQueued: " . $pq->dequeue() . "\n"; $pq->display(); echo "DeQueued: " . $pq->dequeue() . "\n"; $pq->display(); echo "DeQueued: " . $pq->dequeue() . "\n"; $pq->display();
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/8.php
Chapter07/8.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function quickSort(array &$arr, int $p, int $r) { if($p < $r) { $q = partition($arr, $p, $r); quickSort($arr, $p, $q); quickSort($arr, $q+1, $r); } } function partition(array &$arr, int $p, int $r){ $pivot = $arr[$p]; $i = $p-1; $j = $r+1; while(true) { do { $i++; } while($arr[$i] < $pivot && $arr[$i] != $pivot); do { $j--; } while($arr[$j] > $pivot && $arr[$j] != $pivot); if($i < $j){ $temp = $arr[$i]; $arr[$i] = $arr[$j]; $arr[$j] = $temp; } else { return $j; } } } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; quickSort($arr, 0, count($arr)-1); echo implode(",", $arr);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/4.php
Chapter07/4.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function bubbleSort(array $arr): array { $len = count($arr); $count = 0; $bound = $len-1; for ($i = 0; $i < $len; $i++) { $swapped = FALSE; $newBound = 0; for ($j = 0; $j < $bound; $j++) { $count++; if ($arr[$j] > $arr[$j + 1]) { $tmp = $arr[$j + 1]; $arr[$j + 1] = $arr[$j]; $arr[$j] = $tmp; $swapped = TRUE; $newBound = $j; } } $bound = $newBound; if(! $swapped) break; } echo $count."\n"; return $arr; } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; $sortedArray = bubbleSort($arr); echo implode(",", $sortedArray);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/6.php
Chapter07/6.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function insertionSort(array &$arr) { $len = count($arr); for ($i = 1; $i < $len; $i++) { $key = $arr[$i]; $j = $i - 1; while($j >= 0 && $arr[$j] > $key) { $arr[$j+1] = $arr[$j]; $j--; } $arr[$j+1] = $key; } } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; insertionSort($arr); echo implode(",", $arr);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/9.php
Chapter07/9.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function bucketSort(array &$data) { $n = count($data); if ($n <= 0) return; $min = min($data); $max = max($data); $bucket = []; $bLen = $max - $min + 1; $bucket = array_fill(0, $bLen, []); for ($i = 0; $i < $n; $i++) { array_push($bucket[$data[$i] - $min], $data[$i]); } $k = 0; for ($i = 0; $i < $bLen; $i++) { $bCount = count($bucket[$i]); for ($j = 0; $j < $bCount; $j++) { $data[$k] = $bucket[$i][$j]; $k++; } } } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; bucketSort($arr); echo implode(",", $arr);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/7.php
Chapter07/7.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function mergeSort(array $arr): array { $len = count($arr); $mid = (int) $len / 2; if ($len == 1) return $arr; $left = mergeSort(array_slice($arr, 0, $mid)); $right = mergeSort(array_slice($arr, $mid)); return merge($left, $right); } function merge(array $left, array $right): array { $combined = []; $countLeft = count($left); $countRight = count($right); $leftIndex = $rightIndex = 0; while ($leftIndex < $countLeft && $rightIndex < $countRight) { if ($left[$leftIndex] > $right[$rightIndex]) { $combined[] = $right[$rightIndex]; $rightIndex++; } else { $combined[] = $left[$leftIndex]; $leftIndex++; } } while ($leftIndex < $countLeft) { $combined[] = $left[$leftIndex]; $leftIndex++; } while ($rightIndex < $countRight) { $combined[] = $right[$rightIndex]; $rightIndex++; } return $combined; } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; $arr = mergeSort($arr); echo implode(",", $arr);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/10.php
Chapter07/10.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function radixSort(array &$data) { $n = count($data); if ($n <= 0) return; $min = min($data); $max = max($data); $arr = []; $len = $max - $min + 1; $arr = array_fill($min, $len, 0); foreach ($data as $key => $value) { $arr[$value] ++; } $data = []; foreach ($arr as $key => $value) { if ($value == 1) { $data[] = $key; } else { while ($value--) { $data[] = $key; } } } } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; radixSort($arr); echo implode(",", $arr);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/5.php
Chapter07/5.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function selectionSort(array $arr): array { $len = count($arr); for ($i = 0; $i < $len; $i++) { $min = $i; for ($j = $i+1; $j < $len; $j++) { if ($arr[$j] > $arr[$min]) { $min = $j; } } if ($min != $i) { $tmp = $arr[$i]; $arr[$i] = $arr[$min]; $arr[$min] = $tmp; } } return $arr; } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; $sortedArray = selectionSort($arr); echo implode(",", $sortedArray);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/3.php
Chapter07/3.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function bubbleSort(array $arr): array { $len = count($arr); $count = 0; for ($i = 0; $i < $len; $i++) { $swapped = FALSE; for ($j = 0; $j < $len - $i - 1; $j++) { $count++; if ($arr[$j] > $arr[$j + 1]) { $tmp = $arr[$j + 1]; $arr[$j + 1] = $arr[$j]; $arr[$j] = $tmp; $swapped = TRUE; } } if(! $swapped) break; } echo $count."\n"; return $arr; } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; $sortedArray = bubbleSort($arr); echo implode(",", $sortedArray);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/1.php
Chapter07/1.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function bubbleSort(array $arr): array { $count = 0; $len = count($arr); for ($i = 0; $i < $len; $i++) { for ($j = 0; $j < $len - 1; $j++) { $count++; if ($arr[$j] > $arr[$j + 1]) { $tmp = $arr[$j + 1]; $arr[$j + 1] = $arr[$j]; $arr[$j] = $tmp; } } } echo $count."\n"; return $arr; } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; $sortedArray = bubbleSort($arr); echo implode(",", $sortedArray);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter07/2.php
Chapter07/2.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function bubbleSort(array $arr): array { $len = count($arr); $count = 0; for ($i = 0; $i < $len; $i++) { $swapped = FALSE; for ($j = 0; $j < $len - 1; $j++) { $count++; if ($arr[$j] > $arr[$j + 1]) { $tmp = $arr[$j + 1]; $arr[$j + 1] = $arr[$j]; $arr[$j] = $tmp; $swapped = TRUE; } } if(! $swapped) break; } echo $count."\n"; return $arr; } $arr = [20, 45, 93, 67, 10, 97, 52, 88, 33, 92]; $sortedArray = bubbleSort($arr); echo implode(",", $sortedArray);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter01/1.php
Chapter01/1.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function findABook(Array $bookList, string $bookName) { $found = FALSE; foreach($bookList as $index => $book) { if($book === $bookName) { $found = $index; break; } } return $found; } function placeAllBooks(Array $orderedBooks, Array &$bookList) { foreach ($orderedBooks as $book) { $bookFound = findABook($bookList, $book); if($bookFound !== FALSE) { array_splice($bookList, $bookFound, 1); } } } $bookList = ['PHP','MySQL','PGSQL','Oracle','Java']; $orderedBooks = ['MySQL','PGSQL','Java']; placeAllBooks($orderedBooks, $bookList); echo implode(",", $bookList);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/8.php
Chapter09/8.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function Kruskal(array $graph): array { $len = count($graph); $tree = []; $set = []; foreach ($graph as $k => $adj) { $set[$k] = [$k]; } $edges = []; for ($i = 0; $i < $len; $i++) { for ($j = 0; $j < $i; $j++) { if ($graph[$i][$j]) { $edges[$i . ',' . $j] = $graph[$i][$j]; } } } asort($edges); foreach ($edges as $k => $w) { list($i, $j) = explode(',', $k); $iSet = findSet($set, $i); $jSet = findSet($set, $j); if ($iSet != $jSet) { $tree[] = ["from" => $i, "to" => $j, "cost" => $graph[$i][$j]]; unionSet($set, $iSet, $jSet); } } return $tree; } function findSet(array &$set, int $index) { foreach ($set as $k => $v) { if (in_array($index, $v)) { return $k; } } return false; } function unionSet(array &$set, int $i, int $j) { $a = $set[$i]; $b = $set[$j]; unset($set[$i], $set[$j]); $set[] = array_merge($a, $b); } $graph = [ [0, 3, 1, 6, 0, 0], [3, 0, 5, 0, 3, 0], [1, 5, 0, 5, 6, 4], [6, 0, 5, 0, 0, 2], [0, 3, 6, 0, 0, 6], [0, 0, 4, 2, 6, 0] ]; $mst = Kruskal($graph); $minimumCost = 0; /* foreach ($mst as $v) { echo "From " . $v["from"] . " to " . $v["to"] . " cost is " . $v["cost"] . PHP_EOL; $minimumCost += $v["cost"]; } echo "Minimum cost: " . $minimumCost; */ foreach($mst as $v) { echo "From {$v['from']} to {$v['to']} cost is {$v['cost']} \n"; $minimumCost += $v['cost']; } echo "Minimum cost: $minimumCost \n";
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/4.php
Chapter09/4.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function floydWarshall(array $graph): array { $dist = []; $dist = $graph; $size = count($dist); for ($k = 0; $k < $size; $k++) for ($i = 0; $i < $size; $i++) for ($j = 0; $j < $size; $j++) $dist[$i][$j] = min($dist[$i][$j], $dist[$i][$k] + $dist[$k][$j]); return $dist; } $totalVertices = 5; $graph = []; for ($i = 0; $i < $totalVertices; $i++) { for ($j = 0; $j < $totalVertices; $j++) { $graph[$i][$j] = $i == $j ? 0 : PHP_INT_MAX; } } $graph[0][1] = $graph[1][0] = 10; $graph[2][1] = $graph[1][2] = 5; $graph[0][3] = $graph[3][0] = 5; $graph[3][1] = $graph[1][3] = 5; $graph[4][1] = $graph[1][4] = 10; $graph[3][4] = $graph[4][3] = 20; $distance = floydWarshall($graph); echo "Shortest distance between A to E is:" . $distance[0][4] . "\n"; echo "Shortest distance between D to C is:" . $distance[3][2] . "\n";
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/6.php
Chapter09/6.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function bellmanFord(array $graph, int $source): array { $dist = []; $len = count($graph); foreach ($graph as $v => $adj) { $dist[$v] = PHP_INT_MAX; } $dist[$source] = 0; for ($k = 0; $k < $len - 1; $k++) { for ($i = 0; $i < $len; $i++) { for ($j = 0; $j < $len; $j++) { if ($dist[$i] > $dist[$j] + $graph[$j][$i]) { $dist[$i] = $dist[$j] + $graph[$j][$i]; } } } } for ($i = 0; $i < $len; $i++) { for ($j = 0; $j < $len; $j++) { if ($dist[$i] > $dist[$j] + $graph[$j][$i]) { echo 'The graph contains a negative-weight cycle!'; return []; } } } return $dist; } define("I", PHP_INT_MAX); $graph = [ 0 => [I, 3, 5, 9, I, I], 1 => [3, I, 3, 4, 7, I], 2 => [5, 3, I, 2, 6, 3], 3 => [9, 4, 2, I, 2, 2], 4 => [I, 7, 6, 2, I, 5], 5 => [I, I, 3, 2, 5, I] ]; $matrix = array( 0 => array(0, 3, 4), 1 => array(0, 0, 2), 2 => array(0, -2, 0), ); $source = 0; $distances = bellmanFord($graph, $source); foreach($distances as $target => $distance) { echo "distance from $source to $target is $distance \n"; }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/7.php
Chapter09/7.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function primMST(array $graph) { $parent = []; // Array to store the MST $key = []; // Key values used to pick minimum weight edge in cut $visited = []; // represent set of vertices not yet included in MST $len = count($graph); // Initialize all keys as MAX for ($i = 0; $i < $len; $i++) { $key[$i] = PHP_INT_MAX; $visited[$i] = false; } $key[0] = 0; $parent[0] = -1; // The MST will have V vertices for ($count = 0; $count < $len - 1; $count++) { // Pick thd minimum key vertex $minValue = PHP_INT_MAX; $minIndex = -1; foreach (array_keys($graph) as $v) { if ($visited[$v] == false && $key[$v] < $minValue) { $minValue = $key[$v]; $minIndex = $v; } } $u = $minIndex; // Add the picked vertex to the MST Set $visited[$u] = true; for ($v = 0; $v < $len; $v++) { if ($graph[$u][$v] != 0 && $visited[$v] == false && $graph[$u][$v] < $key[$v]) { $parent[$v] = $u; $key[$v] = $graph[$u][$v]; } } } // Print MST echo "Edge\tWeight\n"; $minimumCost = 0; for ($i = 1; $i < $len; $i++) { echo $parent[$i] . " - " . $i . "\t" . $graph[$i][$parent[$i]] . "\n"; $minimumCost += $graph[$i][$parent[$i]]; } echo "Minimum cost: $minimumCost \n"; } $G = [[0, 2, 0, 6, 0], [2, 0, 3, 8, 5], [0, 3, 0, 0, 7], [6, 8, 0, 0, 9], [0, 5, 7, 9, 0], ]; $G = [ [0, 3, 1, 6, 0, 0], [3, 0, 5, 0, 3, 0], [1, 5, 0, 5, 6, 4], [6, 0, 5, 0, 0, 2], [0, 3, 6, 0, 0, 6], [0, 0, 4, 2, 6, 0] ]; primMST($G);
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/5.php
Chapter09/5.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function Dijkstra(array $graph, string $source, string $target): array { $dist = []; $pred = []; $Queue = new SplPriorityQueue(); foreach ($graph as $v => $adj) { $dist[$v] = PHP_INT_MAX; $pred[$v] = null; $Queue->insert($v, min($adj)); } $dist[$source] = 0; while (!$Queue->isEmpty()) { $u = $Queue->extract(); if (!empty($graph[$u])) { foreach ($graph[$u] as $v => $cost) { if ($dist[$u] + $cost < $dist[$v]) { $dist[$v] = $dist[$u] + $cost; $pred[$v] = $u; } } } } $S = new SplStack(); $u = $target; $distance = 0; while (isset($pred[$u]) && $pred[$u]) { $S->push($u); $distance += $graph[$u][$pred[$u]]; $u = $pred[$u]; } if ($S->isEmpty()) { return ["distance" => 0, "path" => $S]; } else { $S->push($source); return ["distance" => $distance, "path" => $S]; } } $graph = [ 'A' => ['B' => 3, 'C' => 5, 'D' => 9], 'B' => ['A' => 3, 'C' => 3, 'D' => 4, 'E' => 7], 'C' => ['A' => 5, 'B' => 3, 'D' => 2, 'E' => 6, 'F' => 3], 'D' => ['A' => 9, 'B' => 4, 'C' => 2, 'E' => 2, 'F' => 2], 'E' => ['B' => 7, 'C' => 6, 'D' => 2, 'F' => 5], 'F' => ['C' => 3, 'D' => 2, 'E' => 5], ]; $source = "A"; $target = "F"; $result = Dijkstra($graph, $source, $target); extract($result); echo "Distance from $source to $target is $distance \n"; echo "Path to follow : "; while (!$path->isEmpty()) { echo $path->pop() . "\t"; }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/3.php
Chapter09/3.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function DFS(array &$graph, int $start, array $visited): SplQueue { $stack = new SplStack; $path = new SplQueue; $stack->push($start); $visited[$start] = 1; while (!$stack->isEmpty()) { $node = $stack->pop(); $path->enqueue($node); foreach ($graph[$node] as $key => $vertex) { if (!$visited[$key] && $vertex == 1) { $visited[$key] = 1; $stack->push($key); } } } return $path; } $graph = [ 0 => [0, 1, 1, 0, 0, 0], 1 => [1, 0, 0, 1, 0, 0], 2 => [1, 0, 0, 1, 0, 0], 3 => [0, 1, 1, 0, 1, 0], 4 => [0, 0, 0, 1, 0, 1], 5 => [0, 0, 0, 0, 1, 0], ]; $graph = []; $visited = []; $vertexCount = 6; for($i = 1;$i<=$vertexCount;$i++) { $graph[$i] = array_fill(1, $vertexCount, 0); $visited[$i] = 0; } $graph[1][2] = $graph[2][1] = 1; $graph[1][5] = $graph[5][1] = 1; $graph[5][2] = $graph[2][5] = 1; $graph[5][4] = $graph[4][5] = 1; $graph[4][3] = $graph[3][4] = 1; $graph[3][2] = $graph[2][3] = 1; $graph[6][4] = $graph[4][6] = 1; $path = DFS($graph, 1, $visited); while (!$path->isEmpty()) { echo $path->dequeue()."\t"; }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/1.php
Chapter09/1.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function topologicalSortKahnV2(array $matrix): array { $sorted = []; $nodes = []; $size = count($matrix); // finding all nodes where indegree = 0 for ($i = 0; $i < $size; $i++) { $sum = 0; for ($j = 0; $j < $size; $j++) $sum += $matrix[$j][$i]; if ($sum == 0) array_push($nodes, $i); } while ($nodes) { $node = array_shift($nodes); array_push($sorted, $node); foreach ($matrix[$node] as $index => $hasEdge) { if ($hasEdge) { $matrix[$node][$index] = 0; $sum = 0; for ($i = 0; $i < $size; $i++) { $sum += $matrix[$i][$index]; } if (!$sum) { array_push($nodes, $index); } } } } return $sorted; } function topologicalSort(array $matrix): SplQueue { $order = new SplQueue; $queue = new SplQueue; $size = count($matrix); $incoming = array_fill(0, $size, 0); for ($i = 0; $i < $size; $i++) { for ($j = 0; $j < $size; $j++) { if ($matrix[$j][$i]) { $incoming[$i] ++; } } if ($incoming[$i] == 0) { $queue->enqueue($i); } } while (!$queue->isEmpty()) { $node = $queue->dequeue(); for ($i = 0; $i < $size; $i++) { if ($matrix[$node][$i] == 1) { $matrix[$node][$i] = 0; $incoming[$i] --; if ($incoming[$i] == 0) { $queue->enqueue($i); } } } $order->enqueue($node); } if ($order->count() != $size) // cycle detected return new SplQueue; return $order; } /* $arr = [ [0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], ]; $count = 5; $arr = []; for($i = 0;$i<$count;$i++) { $arr[] = array_fill(0, $count, 0); } $arr[0][4] = 1; $arr[1][0] = 1; $arr[2][1] = 1; $arr[2][3] = 1; $arr[1][3] = 1; */ $graph = [ [0, 0, 0, 0, 1], [1, 0, 0, 1, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], ]; $sorted = topologicalSort($graph); while (!$sorted->isEmpty()) { echo $sorted->dequeue() . "\t"; }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
PacktPublishing/PHP7-Data-Structures-and-Algorithms
https://github.com/PacktPublishing/PHP7-Data-Structures-and-Algorithms/blob/d5f228ce95b3c09fb173cd3243893ff658384d67/Chapter09/2.php
Chapter09/2.php
<?php /* * Example code for: PHP 7 Data Structures and Algorithms * * Author: Mizanur rahman <mizanur.rahman@gmail.com> * */ function BFS(array &$graph, int $start, array $visited): SplQueue { $queue = new SplQueue; $path = new SplQueue; $queue->enqueue($start); $visited[$start] = 1; while (!$queue->isEmpty()) { $node = $queue->dequeue(); $path->enqueue($node); foreach ($graph[$node] as $key => $vertex) { if (!$visited[$key] && $vertex == 1) { $visited[$key] = 1; $queue->enqueue($key); } } } return $path; } $graph = [ 0 => [0, 1, 1, 0, 0, 0], 1 => [1, 0, 0, 1, 0, 0], 2 => [1, 0, 0, 1, 0, 0], 3 => [0, 1, 1, 0, 1, 0], 4 => [0, 0, 0, 1, 0, 1], 5 => [0, 0, 0, 0, 1, 0], ]; $graph = []; $visited = []; $vertexCount = 6; for($i = 1;$i<=$vertexCount;$i++) { $graph[$i] = array_fill(1, $vertexCount, 0); $visited[$i] = 0; } $graph[1][2] = $graph[2][1] = 1; $graph[1][5] = $graph[5][1] = 1; $graph[5][2] = $graph[2][5] = 1; $graph[5][4] = $graph[4][5] = 1; $graph[4][3] = $graph[3][4] = 1; $graph[3][2] = $graph[2][3] = 1; $graph[6][4] = $graph[4][6] = 1; $path = BFS($graph, 5, $visited); while (!$path->isEmpty()) { echo $path->dequeue()."\t"; }
php
MIT
d5f228ce95b3c09fb173cd3243893ff658384d67
2026-01-05T04:42:44.302062Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/server.php
server.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylor@laravel.com> */ $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel // application without having installed a "real" web server software here. if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { return false; } require_once __DIR__.'/public/index.php';
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Account.php
app/Account.php
<?php namespace App; use Illuminate\Database\Eloquent\SoftDeletes; class Account extends Model { public function users() { return $this->hasMany(User::class); } public function organizations() { return $this->hasMany(Organization::class); } public function contacts() { return $this->hasMany(Contact::class); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Organization.php
app/Organization.php
<?php namespace App; use Illuminate\Database\Eloquent\SoftDeletes; class Organization extends Model { use SoftDeletes; public function contacts() { return $this->hasMany(Contact::class); } public function scopeFilter($query, array $filters) { $query->when($filters['search'] ?? null, function ($query, $search) { $query->where('name', 'like', '%'.$search.'%'); })->when($filters['trashed'] ?? null, function ($query, $trashed) { if ($trashed === 'with') { $query->withTrashed(); } elseif ($trashed === 'only') { $query->onlyTrashed(); } }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/User.php
app/User.php
<?php namespace App; use League\Glide\Server; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\URL; use Illuminate\Auth\Authenticatable; use Illuminate\Support\Facades\Hash; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; class User extends Model implements AuthenticatableContract, AuthorizableContract { use SoftDeletes, Authenticatable, Authorizable; protected $casts = [ 'owner' => 'boolean', ]; public function account() { return $this->belongsTo(Account::class); } public function getNameAttribute() { return $this->first_name.' '.$this->last_name; } public function setPasswordAttribute($password) { $this->attributes['password'] = Hash::needsRehash($password) ? Hash::make($password) : $password; } public function photoUrl(array $attributes) { if ($this->photo_path) { return URL::to(App::make(Server::class)->fromPath($this->photo_path, $attributes)); } } public function isDemoUser() { return $this->email === 'johndoe@example.com'; } public function scopeOrderByName($query) { $query->orderBy('last_name')->orderBy('first_name'); } public function scopeWhereRole($query, $role) { switch ($role) { case 'user': return $query->where('owner', false); case 'owner': return $query->where('owner', true); } } public function scopeFilter($query, array $filters) { $query->when($filters['search'] ?? null, function ($query, $search) { $query->where(function ($query) use ($search) { $query->where('first_name', 'like', '%'.$search.'%') ->orWhere('last_name', 'like', '%'.$search.'%') ->orWhere('email', 'like', '%'.$search.'%'); }); })->when($filters['role'] ?? null, function ($query, $role) { $query->whereRole($role); })->when($filters['trashed'] ?? null, function ($query, $trashed) { if ($trashed === 'with') { $query->withTrashed(); } elseif ($trashed === 'only') { $query->onlyTrashed(); } }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Model.php
app/Model.php
<?php namespace App; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Model as Eloquent; abstract class Model extends Eloquent { protected $guarded = []; protected $perPage = 10; public function resolveRouteBinding($value, $field = null) { return in_array(SoftDeletes::class, class_uses($this)) ? $this->where($this->getRouteKeyName(), $value)->withTrashed()->first() : parent::resolveRouteBinding($value, $field); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Contact.php
app/Contact.php
<?php namespace App; use Illuminate\Database\Eloquent\SoftDeletes; class Contact extends Model { use SoftDeletes; public function organization() { return $this->belongsTo(Organization::class); } public function getNameAttribute() { return $this->first_name.' '.$this->last_name; } public function scopeOrderByName($query) { $query->orderBy('last_name')->orderBy('first_name'); } public function scopeFilter($query, array $filters) { $query->when($filters['search'] ?? null, function ($query, $search) { $query->where(function ($query) use ($search) { $query->where('first_name', 'like', '%'.$search.'%') ->orWhere('last_name', 'like', '%'.$search.'%') ->orWhere('email', 'like', '%'.$search.'%') ->orWhereHas('organization', function ($query) use ($search) { $query->where('name', 'like', '%'.$search.'%'); }); }); })->when($filters['trashed'] ?? null, function ($query, $trashed) { if ($trashed === 'with') { $query->withTrashed(); } elseif ($trashed === 'only') { $query->onlyTrashed(); } }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Exceptions/Handler.php
app/Exceptions/Handler.php
<?php namespace App\Exceptions; use Throwable; use Inertia\Inertia; use Illuminate\Support\Facades\App; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler { /** * A list of the exception types that are not reported. * * @var array */ protected $dontReport = [ // ]; /** * A list of the inputs that are never flashed for validation exceptions. * * @var array */ protected $dontFlash = [ 'password', 'password_confirmation', ]; /** * Report or log an exception. * * @param \Throwable $exception * @return void */ public function report(Throwable $exception) { if (app()->bound('sentry') && $this->shouldReport($exception)) { app('sentry')->captureException($exception); } parent::report($exception); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Throwable $exception * @return \Illuminate\Http\Response */ public function render($request, Throwable $exception) { $response = parent::render($request, $exception); if ( (App::environment('production')) && $request->header('X-Inertia') && in_array($response->status(), [500, 503, 404, 403]) ) { return Inertia::render('Error', ['status' => $response->status()]) ->toResponse($request) ->setStatusCode($response->status()); } return $response; } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Kernel.php
app/Http/Kernel.php
<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, ]; /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ 'throttle:60,1', 'bindings', ], ]; /** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'remember' => \Reinink\RememberQueryStrings::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, ]; /** * The priority-sorted list of middleware. * * This forces non-global middleware to always be in the given order. * * @var array */ protected $middlewarePriority = [ \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\Authenticate::class, \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Auth\Middleware\Authorize::class, ]; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/Controller.php
app/Http/Controllers/Controller.php
<?php namespace App\Http\Controllers; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/ReportsController.php
app/Http/Controllers/ReportsController.php
<?php namespace App\Http\Controllers; use Inertia\Inertia; class ReportsController extends Controller { public function __invoke() { return Inertia::render('Reports/Index'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/ContactsController.php
app/Http/Controllers/ContactsController.php
<?php namespace App\Http\Controllers; use App\Contact; use Inertia\Inertia; use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; class ContactsController extends Controller { public function index() { return Inertia::render('Contacts/Index', [ 'filters' => Request::all('search', 'trashed'), 'contacts' => Auth::user()->account->contacts() ->with('organization') ->orderByName() ->filter(Request::only('search', 'trashed')) ->paginate() ->transform(function ($contact) { return [ 'id' => $contact->id, 'name' => $contact->name, 'phone' => $contact->phone, 'city' => $contact->city, 'deleted_at' => $contact->deleted_at, 'organization' => $contact->organization ? $contact->organization->only('name') : null, ]; }), ]); } public function create() { return Inertia::render('Contacts/Create', [ 'organizations' => Auth::user()->account ->organizations() ->orderBy('name') ->get() ->map ->only('id', 'name'), ]); } public function store() { Auth::user()->account->contacts()->create( Request::validate([ 'first_name' => ['required', 'max:50'], 'last_name' => ['required', 'max:50'], 'organization_id' => ['nullable', Rule::exists('organizations', 'id')->where(function ($query) { $query->where('account_id', Auth::user()->account_id); })], 'email' => ['nullable', 'max:50', 'email'], 'phone' => ['nullable', 'max:50'], 'address' => ['nullable', 'max:150'], 'city' => ['nullable', 'max:50'], 'region' => ['nullable', 'max:50'], 'country' => ['nullable', 'max:2'], 'postal_code' => ['nullable', 'max:25'], ]) ); return Redirect::route('contacts')->with('success', 'Contact created.'); } public function edit(Contact $contact) { return Inertia::render('Contacts/Edit', [ 'contact' => [ 'id' => $contact->id, 'first_name' => $contact->first_name, 'last_name' => $contact->last_name, 'organization_id' => $contact->organization_id, 'email' => $contact->email, 'phone' => $contact->phone, 'address' => $contact->address, 'city' => $contact->city, 'region' => $contact->region, 'country' => $contact->country, 'postal_code' => $contact->postal_code, 'deleted_at' => $contact->deleted_at, ], 'organizations' => Auth::user()->account->organizations() ->orderBy('name') ->get() ->map ->only('id', 'name'), ]); } public function update(Contact $contact) { $contact->update( Request::validate([ 'first_name' => ['required', 'max:50'], 'last_name' => ['required', 'max:50'], 'organization_id' => ['nullable', Rule::exists('organizations', 'id')->where(function ($query) { $query->where('account_id', Auth::user()->account_id); })], 'email' => ['nullable', 'max:50', 'email'], 'phone' => ['nullable', 'max:50'], 'address' => ['nullable', 'max:150'], 'city' => ['nullable', 'max:50'], 'region' => ['nullable', 'max:50'], 'country' => ['nullable', 'max:2'], 'postal_code' => ['nullable', 'max:25'], ]) ); return Redirect::back()->with('success', 'Contact updated.'); } public function destroy(Contact $contact) { $contact->delete(); return Redirect::back()->with('success', 'Contact deleted.'); } public function restore(Contact $contact) { $contact->restore(); return Redirect::back()->with('success', 'Contact restored.'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/ImagesController.php
app/Http/Controllers/ImagesController.php
<?php namespace App\Http\Controllers; use League\Glide\Server; class ImagesController extends Controller { public function show(Server $glide) { return $glide->fromRequest()->response(); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/UsersController.php
app/Http/Controllers/UsersController.php
<?php namespace App\Http\Controllers; use App\User; use Inertia\Inertia; use Illuminate\Validation\Rule; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; use Illuminate\Validation\ValidationException; class UsersController extends Controller { public function index() { return Inertia::render('Users/Index', [ 'filters' => Request::all('search', 'role', 'trashed'), 'users' => Auth::user()->account->users() ->orderByName() ->filter(Request::only('search', 'role', 'trashed')) ->paginate() ->transform(function ($user) { return [ 'id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'owner' => $user->owner, 'photo' => $user->photoUrl(['w' => 40, 'h' => 40, 'fit' => 'crop']), 'deleted_at' => $user->deleted_at, ]; }), ]); } public function create() { return Inertia::render('Users/Create'); } public function store() { Request::validate([ 'first_name' => ['required', 'max:50'], 'last_name' => ['required', 'max:50'], 'email' => ['required', 'max:50', 'email', Rule::unique('users')], 'password' => ['nullable'], 'owner' => ['required', 'boolean'], 'photo' => ['nullable', 'image'], ]); Auth::user()->account->users()->create([ 'first_name' => Request::get('first_name'), 'last_name' => Request::get('last_name'), 'email' => Request::get('email'), 'password' => Request::get('password'), 'owner' => Request::get('owner'), 'photo_path' => Request::file('photo') ? Request::file('photo')->store('users') : null, ]); return Redirect::route('users')->with('success', 'User created.'); } public function edit(User $user) { return Inertia::render('Users/Edit', [ 'user' => [ 'id' => $user->id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'owner' => $user->owner, 'photo' => $user->photoUrl(['w' => 60, 'h' => 60, 'fit' => 'crop']), 'deleted_at' => $user->deleted_at, ], ]); } public function update(User $user) { if (App::environment('production') && $user->isDemoUser()) { return Redirect::back()->with('error', 'Updating the demo user is not allowed.'); } Request::validate([ 'first_name' => ['required', 'max:50'], 'last_name' => ['required', 'max:50'], 'email' => ['required', 'max:50', 'email', Rule::unique('users')->ignore($user->id)], 'password' => ['nullable'], 'owner' => ['required', 'boolean'], 'photo' => ['nullable', 'image'], ]); $user->update(Request::only('first_name', 'last_name', 'email', 'owner')); if (Request::file('photo')) { $user->update(['photo_path' => Request::file('photo')->store('users')]); } if (Request::get('password')) { $user->update(['password' => Request::get('password')]); } return Redirect::back()->with('success', 'User updated.'); } public function destroy(User $user) { if (App::environment('production') && $user->isDemoUser()) { return Redirect::back()->with('error', 'Deleting the demo user is not allowed.'); } $user->delete(); return Redirect::back()->with('success', 'User deleted.'); } public function restore(User $user) { $user->restore(); return Redirect::back()->with('success', 'User restored.'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/OrganizationsController.php
app/Http/Controllers/OrganizationsController.php
<?php namespace App\Http\Controllers; use Inertia\Inertia; use App\Organization; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; class OrganizationsController extends Controller { public function index() { return Inertia::render('Organizations/Index', [ 'filters' => Request::all('search', 'trashed'), 'organizations' => Auth::user()->account->organizations() ->orderBy('name') ->filter(Request::only('search', 'trashed')) ->paginate() ->only('id', 'name', 'phone', 'city', 'deleted_at'), ]); } public function create() { return Inertia::render('Organizations/Create'); } public function store() { Auth::user()->account->organizations()->create( Request::validate([ 'name' => ['required', 'max:100'], 'email' => ['nullable', 'max:50', 'email'], 'phone' => ['nullable', 'max:50'], 'address' => ['nullable', 'max:150'], 'city' => ['nullable', 'max:50'], 'region' => ['nullable', 'max:50'], 'country' => ['nullable', 'max:2'], 'postal_code' => ['nullable', 'max:25'], ]) ); return Redirect::route('organizations')->with('success', 'Organization created.'); } public function edit(Organization $organization) { return Inertia::render('Organizations/Edit', [ 'organization' => [ 'id' => $organization->id, 'name' => $organization->name, 'email' => $organization->email, 'phone' => $organization->phone, 'address' => $organization->address, 'city' => $organization->city, 'region' => $organization->region, 'country' => $organization->country, 'postal_code' => $organization->postal_code, 'deleted_at' => $organization->deleted_at, 'contacts' => $organization->contacts()->orderByName()->get()->map->only('id', 'name', 'city', 'phone'), ], ]); } public function update(Organization $organization) { $organization->update( Request::validate([ 'name' => ['required', 'max:100'], 'email' => ['nullable', 'max:50', 'email'], 'phone' => ['nullable', 'max:50'], 'address' => ['nullable', 'max:150'], 'city' => ['nullable', 'max:50'], 'region' => ['nullable', 'max:50'], 'country' => ['nullable', 'max:2'], 'postal_code' => ['nullable', 'max:25'], ]) ); return Redirect::back()->with('success', 'Organization updated.'); } public function destroy(Organization $organization) { $organization->delete(); return Redirect::back()->with('success', 'Organization deleted.'); } public function restore(Organization $organization) { $organization->restore(); return Redirect::back()->with('success', 'Organization restored.'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/DashboardController.php
app/Http/Controllers/DashboardController.php
<?php namespace App\Http\Controllers; use Inertia\Inertia; class DashboardController extends Controller { public function __invoke() { return Inertia::render('Dashboard/Index'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/Auth/LoginController.php
app/Http/Controllers/Auth/LoginController.php
<?php namespace App\Http\Controllers\Auth; use Inertia\Inertia; use Illuminate\Http\Request; use Illuminate\Support\Facades\URL; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Response; use Illuminate\Foundation\Auth\AuthenticatesUsers; class LoginController extends Controller { /* |-------------------------------------------------------------------------- | Login Controller |-------------------------------------------------------------------------- | | This controller handles authenticating users for the application and | redirecting them to your home screen. The controller uses a trait | to conveniently provide its functionality to your applications. | */ use AuthenticatesUsers; /** * Where to redirect users after login. * * @var string */ protected $redirectTo = '/'; public function showLoginForm() { return Inertia::render('Auth/Login'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/Auth/VerificationController.php
app/Http/Controllers/Auth/VerificationController.php
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\VerifiesEmails; class VerificationController extends Controller { /* |-------------------------------------------------------------------------- | Email Verification Controller |-------------------------------------------------------------------------- | | This controller is responsible for handling email verification for any | user that recently registered with the application. Emails may also | be re-sent if the user didn't receive the original email message. | */ use VerifiesEmails; /** * Where to redirect users after verification. * * @var string */ protected $redirectTo = '/home'; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth'); $this->middleware('signed')->only('verify'); $this->middleware('throttle:6,1')->only('verify', 'resend'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/Auth/ForgotPasswordController.php
app/Http/Controllers/Auth/ForgotPasswordController.php
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\SendsPasswordResetEmails; class ForgotPasswordController extends Controller { /* |-------------------------------------------------------------------------- | Password Reset Controller |-------------------------------------------------------------------------- | | This controller is responsible for handling password reset emails and | includes a trait which assists in sending these notifications from | your application to your users. Feel free to explore this trait. | */ use SendsPasswordResetEmails; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/Auth/ResetPasswordController.php
app/Http/Controllers/Auth/ResetPasswordController.php
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\ResetsPasswords; class ResetPasswordController extends Controller { /* |-------------------------------------------------------------------------- | Password Reset Controller |-------------------------------------------------------------------------- | | This controller is responsible for handling password reset requests | and uses a simple trait to include this behavior. You're free to | explore this trait and override any methods you wish to tweak. | */ use ResetsPasswords; /** * Where to redirect users after resetting their password. * * @var string */ protected $redirectTo = '/home'; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Controllers/Auth/RegisterController.php
app/Http/Controllers/Auth/RegisterController.php
<?php namespace App\Http\Controllers\Auth; use App\User; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; use Illuminate\Foundation\Auth\RegistersUsers; class RegisterController extends Controller { /* |-------------------------------------------------------------------------- | Register Controller |-------------------------------------------------------------------------- | | This controller handles the registration of new users as well as their | validation and creation. By default this controller uses a trait to | provide this functionality without requiring any additional code. | */ use RegistersUsers; /** * Where to redirect users after registration. * * @var string */ protected $redirectTo = '/home'; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest'); } /** * Get a validator for an incoming registration request. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); } /** * Create a new user instance after a valid registration. * * @param array $data * @return \App\User */ protected function create(array $data) { return User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/Authenticate.php
app/Http/Middleware/Authenticate.php
<?php namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request * @return string */ protected function redirectTo($request) { if (! $request->expectsJson()) { return route('login'); } } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/RedirectIfAuthenticated.php
app/Http/Middleware/RedirectIfAuthenticated.php
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/'); } return $next($request); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/TrustProxies.php
app/Http/Middleware/TrustProxies.php
<?php namespace App\Http\Middleware; use Illuminate\Http\Request; use Fideloper\Proxy\TrustProxies as Middleware; class TrustProxies extends Middleware { /** * The trusted proxies for this application. * * @var array */ protected $proxies = '**'; /** * The headers that should be used to detect proxies. * * @var int */ protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/TrimStrings.php
app/Http/Middleware/TrimStrings.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; class TrimStrings extends Middleware { /** * The names of the attributes that should not be trimmed. * * @var array */ protected $except = [ 'password', 'password_confirmation', ]; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/CheckForMaintenanceMode.php
app/Http/Middleware/CheckForMaintenanceMode.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware; class CheckForMaintenanceMode extends Middleware { /** * The URIs that should be reachable while maintenance mode is enabled. * * @var array */ protected $except = [ // ]; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/EncryptCookies.php
app/Http/Middleware/EncryptCookies.php
<?php namespace App\Http\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; class EncryptCookies extends Middleware { /** * The names of the cookies that should not be encrypted. * * @var array */ protected $except = [ // ]; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Http/Middleware/VerifyCsrfToken.php
app/Http/Middleware/VerifyCsrfToken.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * Indicates whether the XSRF-TOKEN cookie should be set on the response. * * @var bool */ protected $addHttpCookie = true; /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ // ]; }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Console/Kernel.php
app/Console/Kernel.php
<?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ // ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // $schedule->command('inspire') // ->hourly(); } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Providers/BroadcastServiceProvider.php
app/Providers/BroadcastServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Broadcast; class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { Broadcast::routes(); require base_path('routes/channels.php'); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Providers/RouteServiceProvider.php
app/Providers/RouteServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; class RouteServiceProvider extends ServiceProvider { /** * This namespace is applied to your controller routes. * * In addition, it is set as the URL generator's root namespace. * * @var string */ protected $namespace = 'App\Http\Controllers'; /** * Define your route model bindings, pattern filters, etc. * * @return void */ public function boot() { // parent::boot(); } /** * Define the routes for the application. * * @return void */ public function map() { $this->mapApiRoutes(); $this->mapWebRoutes(); // } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapWebRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. * * @return void */ protected function mapApiRoutes() { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Providers/EventServiceProvider.php
app/Providers/EventServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\Event; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider { /** * The event listener mappings for the application. * * @var array */ protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, ], ]; /** * Register any events for your application. * * @return void */ public function boot() { parent::boot(); // } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Providers/AppServiceProvider.php
app/Providers/AppServiceProvider.php
<?php namespace App\Providers; use Inertia\Inertia; use League\Glide\Server; use Carbon\CarbonImmutable; use Illuminate\Support\Collection; use Illuminate\Pagination\UrlWindow; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Date; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Storage; use Illuminate\Support\ServiceProvider; use Illuminate\Pagination\LengthAwarePaginator; class AppServiceProvider extends ServiceProvider { public function boot() { Date::use(CarbonImmutable::class); } public function register() { $this->registerInertia(); $this->registerGlide(); $this->registerLengthAwarePaginator(); } public function registerInertia() { Inertia::version(function () { return md5_file(public_path('mix-manifest.json')); }); Inertia::share([ 'auth' => function () { return [ 'user' => Auth::user() ? [ 'id' => Auth::user()->id, 'first_name' => Auth::user()->first_name, 'last_name' => Auth::user()->last_name, 'email' => Auth::user()->email, 'role' => Auth::user()->role, 'account' => [ 'id' => Auth::user()->account->id, 'name' => Auth::user()->account->name, ], ] : null, ]; }, 'flash' => function () { return [ 'success' => Session::get('success'), 'error' => Session::get('error'), ]; }, 'errors' => function () { return Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) []; }, ]); } protected function registerGlide() { $this->app->bind(Server::class, function ($app) { return Server::create([ 'source' => Storage::getDriver(), 'cache' => Storage::getDriver(), 'cache_folder' => '.glide-cache', 'base_url' => 'img', ]); }); } protected function registerLengthAwarePaginator() { $this->app->bind(LengthAwarePaginator::class, function ($app, $values) { return new class (...array_values($values)) extends LengthAwarePaginator { public function only(...$attributes) { return $this->transform(function ($item) use ($attributes) { return $item->only($attributes); }); } public function transform($callback) { $this->items->transform($callback); return $this; } public function toArray() { return [ 'data' => $this->items->toArray(), 'links' => $this->links(), ]; } public function links($view = null, $data = []) { $this->appends(Request::all()); $window = UrlWindow::make($this); $elements = array_filter([ $window['first'], is_array($window['slider']) ? '...' : null, $window['slider'], is_array($window['last']) ? '...' : null, $window['last'], ]); return Collection::make($elements)->flatMap(function ($item) { if (is_array($item)) { return Collection::make($item)->map(function ($url, $page) { return [ 'url' => $url, 'label' => $page, 'active' => $this->currentPage() === $page, ]; }); } else { return [ [ 'url' => null, 'label' => '...', 'active' => false, ], ]; } })->prepend([ 'url' => $this->previousPageUrl(), 'label' => 'Previous', 'active' => false, ])->push([ 'url' => $this->nextPageUrl(), 'label' => 'Next', 'active' => false, ]); } }; }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/app/Providers/AuthServiceProvider.php
app/Providers/AuthServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ // 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); // } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/bootstrap/app.php
bootstrap/app.php
<?php /* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | | The first thing we will do is create a new Laravel application instance | which serves as the "glue" for all the components of Laravel, and is | the IoC container for the system binding all of the various parts. | */ $app = new Illuminate\Foundation\Application( $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) ); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton( Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class ); $app->singleton( Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class ); $app->singleton( Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class ); /* |-------------------------------------------------------------------------- | Return The Application |-------------------------------------------------------------------------- | | This script returns the application instance. The instance is given to | the calling script so we can separate the building of the instances | from the actual running of the application and sending responses. | */ return $app;
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/tests/TestCase.php
tests/TestCase.php
<?php namespace Tests; use Illuminate\Support\Arr; use PHPUnit\Framework\Assert; use Illuminate\Foundation\Testing\TestResponse; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { use CreatesApplication; protected function setUp(): void { parent::setUp(); TestResponse::macro('props', function ($key = null) { $props = json_decode(json_encode($this->original->getData()['page']['props']), JSON_OBJECT_AS_ARRAY); if ($key) { return Arr::get($props, $key); } return $props; }); TestResponse::macro('assertHasProp', function ($key) { Assert::assertTrue(Arr::has($this->props(), $key)); return $this; }); TestResponse::macro('assertPropValue', function ($key, $value) { $this->assertHasProp($key); if (is_callable($value)) { $value($this->props($key)); } else { Assert::assertEquals($this->props($key), $value); } return $this; }); TestResponse::macro('assertPropCount', function ($key, $count) { $this->assertHasProp($key); Assert::assertCount($count, $this->props($key)); return $this; }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/tests/CreatesApplication.php
tests/CreatesApplication.php
<?php namespace Tests; use Illuminate\Contracts\Console\Kernel; trait CreatesApplication { /** * Creates the application. * * @return \Illuminate\Foundation\Application */ public function createApplication() { $app = require __DIR__.'/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); return $app; } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/tests/Feature/ContactsTest.php
tests/Feature/ContactsTest.php
<?php namespace Tests\Feature; use App\User; use App\Account; use App\Contact; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; class ContactsTest extends TestCase { use RefreshDatabase; protected function setUp(): void { parent::setUp(); $account = Account::create(['name' => 'Acme Corporation']); $this->user = factory(User::class)->create([ 'account_id' => $account->id, 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'johndoe@example.com', 'owner' => true, ]); } public function test_can_view_contacts() { $this->user->account->contacts()->saveMany( factory(Contact::class, 5)->make() ); $this->actingAs($this->user) ->get('/contacts') ->assertStatus(200) ->assertPropCount('contacts.data', 5) ->assertPropValue('contacts.data', function ($contacts) { $this->assertEquals( ['id', 'name', 'phone', 'city', 'deleted_at', 'organization'], array_keys($contacts[0]) ); }); } public function test_can_search_for_contacts() { $this->user->account->contacts()->saveMany( factory(contact::class, 5)->make() )->first()->update([ 'first_name' => 'Greg', 'last_name' => 'Andersson' ]); $this->actingAs($this->user) ->get('/contacts?search=Greg') ->assertStatus(200) ->assertPropValue('filters.search', 'Greg') ->assertPropCount('contacts.data', 1) ->assertPropValue('contacts.data', function ($contacts) { $this->assertEquals('Greg Andersson', $contacts[0]['name']); }); } public function test_cannot_view_deleted_contacts() { $this->user->account->contacts()->saveMany( factory(contact::class, 5)->make() )->first()->delete(); $this->actingAs($this->user) ->get('/contacts') ->assertStatus(200) ->assertPropCount('contacts.data', 4); } public function test_can_filter_to_view_deleted_contacts() { $this->user->account->contacts()->saveMany( factory(contact::class, 5)->make() )->first()->delete(); $this->actingAs($this->user) ->get('/contacts?trashed=with') ->assertStatus(200) ->assertPropValue('filters.trashed', 'with') ->assertPropCount('contacts.data', 5); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/tests/Feature/OrganizationsTest.php
tests/Feature/OrganizationsTest.php
<?php namespace Tests\Feature; use App\User; use App\Account; use Tests\TestCase; use App\Organization; use Illuminate\Foundation\Testing\RefreshDatabase; class OrganizationsTest extends TestCase { use RefreshDatabase; protected function setUp(): void { parent::setUp(); $account = Account::create(['name' => 'Acme Corporation']); $this->user = factory(User::class)->create([ 'account_id' => $account->id, 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'johndoe@example.com', 'owner' => true, ]); } public function test_can_view_organizations() { $this->user->account->organizations()->saveMany( factory(Organization::class, 5)->make() ); $this->actingAs($this->user) ->get('/organizations') ->assertStatus(200) ->assertPropCount('organizations.data', 5) ->assertPropValue('organizations.data', function ($organizations) { $this->assertEquals( ['id', 'name', 'phone', 'city', 'deleted_at'], array_keys($organizations[0]) ); }); } public function test_can_search_for_organizations() { $this->user->account->organizations()->saveMany( factory(Organization::class, 5)->make() )->first()->update(['name' => 'Some Big Fancy Company Name']); $this->actingAs($this->user) ->get('/organizations?search=Some Big Fancy Company Name') ->assertStatus(200) ->assertPropValue('filters.search', 'Some Big Fancy Company Name') ->assertPropCount('organizations.data', 1) ->assertPropValue('organizations.data', function ($organizations) { $this->assertEquals('Some Big Fancy Company Name', $organizations[0]['name']); }); } public function test_cannot_view_deleted_organizations() { $this->user->account->organizations()->saveMany( factory(Organization::class, 5)->make() )->first()->delete(); $this->actingAs($this->user) ->get('/organizations') ->assertStatus(200) ->assertPropCount('organizations.data', 4); } public function test_can_filter_to_view_deleted_organizations() { $this->user->account->organizations()->saveMany( factory(Organization::class, 5)->make() )->first()->delete(); $this->actingAs($this->user) ->get('/organizations?trashed=with') ->assertStatus(200) ->assertPropValue('filters.trashed', 'with') ->assertPropCount('organizations.data', 5); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/routes/web.php
routes/web.php
<?php /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ // Auth Route::get('login')->name('login')->uses('Auth\LoginController@showLoginForm')->middleware('guest'); Route::post('login')->name('login.attempt')->uses('Auth\LoginController@login')->middleware('guest'); Route::post('logout')->name('logout')->uses('Auth\LoginController@logout'); // Dashboard Route::get('/')->name('dashboard')->uses('DashboardController')->middleware('auth'); // Users Route::get('users')->name('users')->uses('UsersController@index')->middleware('remember', 'auth'); Route::get('users/create')->name('users.create')->uses('UsersController@create')->middleware('auth'); Route::post('users')->name('users.store')->uses('UsersController@store')->middleware('auth'); Route::get('users/{user}/edit')->name('users.edit')->uses('UsersController@edit')->middleware('auth'); Route::put('users/{user}')->name('users.update')->uses('UsersController@update')->middleware('auth'); Route::delete('users/{user}')->name('users.destroy')->uses('UsersController@destroy')->middleware('auth'); Route::put('users/{user}/restore')->name('users.restore')->uses('UsersController@restore')->middleware('auth'); // Images Route::get('/img/{path}', 'ImagesController@show')->where('path', '.*'); // Organizations Route::get('organizations')->name('organizations')->uses('OrganizationsController@index')->middleware('remember', 'auth'); Route::get('organizations/create')->name('organizations.create')->uses('OrganizationsController@create')->middleware('auth'); Route::post('organizations')->name('organizations.store')->uses('OrganizationsController@store')->middleware('auth'); Route::get('organizations/{organization}/edit')->name('organizations.edit')->uses('OrganizationsController@edit')->middleware('auth'); Route::put('organizations/{organization}')->name('organizations.update')->uses('OrganizationsController@update')->middleware('auth'); Route::delete('organizations/{organization}')->name('organizations.destroy')->uses('OrganizationsController@destroy')->middleware('auth'); Route::put('organizations/{organization}/restore')->name('organizations.restore')->uses('OrganizationsController@restore')->middleware('auth'); // Contacts Route::get('contacts')->name('contacts')->uses('ContactsController@index')->middleware('remember', 'auth'); Route::get('contacts/create')->name('contacts.create')->uses('ContactsController@create')->middleware('auth'); Route::post('contacts')->name('contacts.store')->uses('ContactsController@store')->middleware('auth'); Route::get('contacts/{contact}/edit')->name('contacts.edit')->uses('ContactsController@edit')->middleware('auth'); Route::put('contacts/{contact}')->name('contacts.update')->uses('ContactsController@update')->middleware('auth'); Route::delete('contacts/{contact}')->name('contacts.destroy')->uses('ContactsController@destroy')->middleware('auth'); Route::put('contacts/{contact}/restore')->name('contacts.restore')->uses('ContactsController@restore')->middleware('auth'); // Reports Route::get('reports')->name('reports')->uses('ReportsController')->middleware('auth'); // 500 error Route::get('500', function () { echo $fail; });
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/routes/channels.php
routes/channels.php
<?php /* |-------------------------------------------------------------------------- | Broadcast Channels |-------------------------------------------------------------------------- | | Here you may register all of the event broadcasting channels that your | application supports. The given channel authorization callbacks are | used to check if an authenticated user can listen to the channel. | */ Broadcast::channel('App.User.{id}', function ($user, $id) { return (int) $user->id === (int) $id; });
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/routes/api.php
routes/api.php
<?php use Illuminate\Http\Request; /* |-------------------------------------------------------------------------- | API Routes |-------------------------------------------------------------------------- | | Here is where you can register API routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | is assigned the "api" middleware group. Enjoy building your API! | */ Route::middleware('auth:api')->get('/user', function (Request $request) { return $request->user(); });
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/routes/console.php
routes/console.php
<?php use Illuminate\Foundation\Inspiring; /* |-------------------------------------------------------------------------- | Console Routes |-------------------------------------------------------------------------- | | This file is where you may define all of your Closure based console | commands. Each Closure is bound to a command instance allowing a | simple approach to interacting with each command's IO methods. | */ Artisan::command('inspire', function () { $this->comment(Inspiring::quote()); })->describe('Display an inspiring quote');
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/public/index.php
public/index.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylor@laravel.com> */ define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | */ require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__.'/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response);
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/app.php
config/app.php
<?php return [ /* |-------------------------------------------------------------------------- | Application Name |-------------------------------------------------------------------------- | | This value is the name of your application. This value is used when the | framework needs to place the application's name in a notification or | any other location as required by the application or its packages. | */ 'name' => env('APP_NAME', 'Laravel'), /* |-------------------------------------------------------------------------- | Application Environment |-------------------------------------------------------------------------- | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various | services the application utilizes. Set this in your ".env" file. | */ 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- | | When your application is in debug mode, detailed error messages with | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | */ 'debug' => env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- | Application URL |-------------------------------------------------------------------------- | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of | your application so that it is used when running Artisan tasks. | */ 'url' => env('APP_URL', 'http://localhost'), 'asset_url' => env('ASSET_URL', null), /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | */ 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- | Application Locale Configuration |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used | by the translation service provider. You are free to set this value | to any of the locales which will be supported by the application. | */ 'locale' => 'en', /* |-------------------------------------------------------------------------- | Application Fallback Locale |-------------------------------------------------------------------------- | | The fallback locale determines the locale to use when the current one | is not available. You may change the value to correspond to any of | the language folders that are provided through your application. | */ 'fallback_locale' => 'en', /* |-------------------------------------------------------------------------- | Faker Locale |-------------------------------------------------------------------------- | | This locale will be used by the Faker PHP library when generating fake | data for your database seeds. For example, this will be used to get | localized telephone numbers, street address information and more. | */ 'faker_locale' => 'en_US', /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | This key is used by the Illuminate encrypter service and should be set | to a random, 32 character string, otherwise these encrypted strings | will not be safe. Please do this before deploying an application! | */ 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- | Autoloaded Service Providers |-------------------------------------------------------------------------- | | The service providers listed here will be automatically loaded on the | request to your application. Feel free to add your own services to | this array to grant expanded functionality to your applications. | */ 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, Illuminate\Cache\CacheServiceProvider::class, Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, Illuminate\Cookie\CookieServiceProvider::class, Illuminate\Database\DatabaseServiceProvider::class, Illuminate\Encryption\EncryptionServiceProvider::class, Illuminate\Filesystem\FilesystemServiceProvider::class, Illuminate\Foundation\Providers\FoundationServiceProvider::class, Illuminate\Hashing\HashServiceProvider::class, Illuminate\Mail\MailServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class, Illuminate\Pagination\PaginationServiceProvider::class, Illuminate\Pipeline\PipelineServiceProvider::class, Illuminate\Queue\QueueServiceProvider::class, Illuminate\Redis\RedisServiceProvider::class, Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, Illuminate\Session\SessionServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, /* * Package Service Providers... */ /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, ], /* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Arr' => Illuminate\Support\Arr::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, 'Auth' => Illuminate\Support\Facades\Auth::class, 'Blade' => Illuminate\Support\Facades\Blade::class, 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 'Bus' => Illuminate\Support\Facades\Bus::class, 'Cache' => Illuminate\Support\Facades\Cache::class, 'Config' => Illuminate\Support\Facades\Config::class, 'Cookie' => Illuminate\Support\Facades\Cookie::class, 'Crypt' => Illuminate\Support\Facades\Crypt::class, 'DB' => Illuminate\Support\Facades\DB::class, 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 'Event' => Illuminate\Support\Facades\Event::class, 'File' => Illuminate\Support\Facades\File::class, 'Gate' => Illuminate\Support\Facades\Gate::class, 'Hash' => Illuminate\Support\Facades\Hash::class, 'Lang' => Illuminate\Support\Facades\Lang::class, 'Log' => Illuminate\Support\Facades\Log::class, 'Mail' => Illuminate\Support\Facades\Mail::class, 'Notification' => Illuminate\Support\Facades\Notification::class, 'Password' => Illuminate\Support\Facades\Password::class, 'Queue' => Illuminate\Support\Facades\Queue::class, 'Redirect' => Illuminate\Support\Facades\Redirect::class, 'Redis' => Illuminate\Support\Facades\Redis::class, 'Request' => Illuminate\Support\Facades\Request::class, 'Response' => Illuminate\Support\Facades\Response::class, 'Route' => Illuminate\Support\Facades\Route::class, 'Schema' => Illuminate\Support\Facades\Schema::class, 'Session' => Illuminate\Support\Facades\Session::class, 'Storage' => Illuminate\Support\Facades\Storage::class, 'Str' => Illuminate\Support\Str::class, 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/logging.php
config/logging.php
<?php use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; return [ /* |-------------------------------------------------------------------------- | Default Log Channel |-------------------------------------------------------------------------- | | This option defines the default log channel that gets used when writing | messages to the logs. The name specified in this option should match | one of the channels defined in the "channels" configuration array. | */ 'default' => env('LOG_CHANNEL', 'stack'), /* |-------------------------------------------------------------------------- | Log Channels |-------------------------------------------------------------------------- | | Here you may configure the log channels for your application. Out of | the box, Laravel uses the Monolog PHP logging library. This gives | you a variety of powerful log handlers / formatters to utilize. | | Available Drivers: "single", "daily", "slack", "syslog", | "errorlog", "monolog", | "custom", "stack" | */ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', 'days' => 14, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => 'critical', ], 'papertrail' => [ 'driver' => 'monolog', 'level' => 'debug', 'handler' => SyslogUdpHandler::class, 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), ], ], 'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], ], 'syslog' => [ 'driver' => 'syslog', 'level' => 'debug', ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => 'debug', ], 'null' => [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/session.php
config/session.php
<?php use Illuminate\Support\Str; return [ /* |-------------------------------------------------------------------------- | Default Session Driver |-------------------------------------------------------------------------- | | This option controls the default session "driver" that will be used on | requests. By default, we will use the lightweight native driver but | you may specify any of the other wonderful drivers provided here. | | Supported: "file", "cookie", "database", "apc", | "memcached", "redis", "dynamodb", "array" | */ 'driver' => env('SESSION_DRIVER', 'cookie'), /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | */ 'lifetime' => env('SESSION_LIFETIME', 120), 'expire_on_close' => false, /* |-------------------------------------------------------------------------- | Session Encryption |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data | should be encrypted before it is stored. All encryption will be run | automatically by Laravel and you can use the Session like normal. | */ 'encrypt' => false, /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | | When using the native session driver, we need a location where session | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | */ 'files' => storage_path('framework/sessions'), /* |-------------------------------------------------------------------------- | Session Database Connection |-------------------------------------------------------------------------- | | When using the "database" or "redis" session drivers, you may specify a | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | */ 'connection' => env('SESSION_CONNECTION', null), /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | | When using the "database" session driver, you may specify the table we | should use to manage the sessions. Of course, a sensible default is | provided for you; however, you are free to change this as needed. | */ 'table' => 'sessions', /* |-------------------------------------------------------------------------- | Session Cache Store |-------------------------------------------------------------------------- | | When using the "apc", "memcached", or "dynamodb" session drivers you may | list a cache store that should be used for these sessions. This value | must match with one of the application's configured cache "stores". | */ 'store' => env('SESSION_STORE', null), /* |-------------------------------------------------------------------------- | Session Sweeping Lottery |-------------------------------------------------------------------------- | | Some session drivers must manually sweep their storage location to get | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | */ 'lottery' => [2, 100], /* |-------------------------------------------------------------------------- | Session Cookie Name |-------------------------------------------------------------------------- | | Here you may change the name of the cookie used to identify a session | instance by ID. The name specified here will get used every time a | new session cookie is created by the framework for every driver. | */ 'cookie' => env( 'SESSION_COOKIE', Str::slug(env('APP_NAME', 'laravel'), '_').'_session' ), /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | */ 'path' => '/', /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | | Here you may change the domain of the cookie used to identify a session | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | */ 'domain' => env('SESSION_DOMAIN', null), /* |-------------------------------------------------------------------------- | HTTPS Only Cookies |-------------------------------------------------------------------------- | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you if it can not be done securely. | */ 'secure' => env('SESSION_SECURE_COOKIE', null), /* |-------------------------------------------------------------------------- | HTTP Access Only |-------------------------------------------------------------------------- | | Setting this value to true will prevent JavaScript from accessing the | value of the cookie and the cookie will only be accessible through | the HTTP protocol. You are free to modify this option if needed. | */ 'http_only' => true, /* |-------------------------------------------------------------------------- | Same-Site Cookies |-------------------------------------------------------------------------- | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we | do not enable this as other CSRF protection services are in place. | | Supported: "lax", "strict", "none" | */ 'same_site' => null, ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/queue.php
config/queue.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Queue Connection Name |-------------------------------------------------------------------------- | | Laravel's queue API supports an assortment of back-ends via a single | API, giving you convenient access to each back-end using the same | syntax for every one. Here you may define a default connection. | */ 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | | Here you may configure the connection information for each server that | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | */ 'connections' => [ 'sync' => [ 'driver' => 'sync', ], 'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', 'retry_after' => 90, 'block_for' => 0, ], 'sqs' => [ 'driver' => 'sqs', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'queue' => env('SQS_QUEUE', 'your-queue-name'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, 'block_for' => null, ], ], /* |-------------------------------------------------------------------------- | Failed Queue Jobs |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you | can control which database and table are used to store the jobs that | have failed. You may change them to any database / table you wish. | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/sentry.php
config/sentry.php
<?php return [ 'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')), // capture release as git sha // 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')), 'breadcrumbs' => [ // Capture Laravel logs in breadcrumbs 'logs' => true, // Capture SQL queries in breadcrumbs 'sql_queries' => true, // Capture bindings on SQL queries logged in breadcrumbs 'sql_bindings' => true, // Capture queue job information in breadcrumbs 'queue_info' => true, ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/cache.php
config/cache.php
<?php use Illuminate\Support\Str; return [ /* |-------------------------------------------------------------------------- | Default Cache Store |-------------------------------------------------------------------------- | | This option controls the default cache connection that gets used while | using this caching library. This connection is used when another is | not explicitly specified when executing a given caching function. | | Supported: "apc", "array", "database", "file", | "memcached", "redis", "dynamodb" | */ 'default' => env('CACHE_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Cache Stores |-------------------------------------------------------------------------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | */ 'stores' => [ 'apc' => [ 'driver' => 'apc', ], 'array' => [ 'driver' => 'array', ], 'database' => [ 'driver' => 'database', 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'cache', ], 'dynamodb' => [ 'driver' => 'dynamodb', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], ], /* |-------------------------------------------------------------------------- | Cache Key Prefix |-------------------------------------------------------------------------- | | When utilizing a RAM based store such as APC or Memcached, there might | be other applications utilizing the same cache. So, we'll specify a | value to get prefixed to all our keys so we can avoid collisions. | */ 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/hashing.php
config/hashing.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Hash Driver |-------------------------------------------------------------------------- | | This option controls the default hash driver that will be used to hash | passwords for your application. By default, the bcrypt algorithm is | used; however, you remain free to modify this option if you wish. | | Supported: "bcrypt", "argon", "argon2id" | */ 'driver' => 'bcrypt', /* |-------------------------------------------------------------------------- | Bcrypt Options |-------------------------------------------------------------------------- | | Here you may specify the configuration options that should be used when | passwords are hashed using the Bcrypt algorithm. This will allow you | to control the amount of time it takes to hash the given password. | */ 'bcrypt' => [ 'rounds' => env('BCRYPT_ROUNDS', 10), ], /* |-------------------------------------------------------------------------- | Argon Options |-------------------------------------------------------------------------- | | Here you may specify the configuration options that should be used when | passwords are hashed using the Argon algorithm. These will allow you | to control the amount of time it takes to hash the given password. | */ 'argon' => [ 'memory' => 1024, 'threads' => 2, 'time' => 2, ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/view.php
config/view.php
<?php return [ /* |-------------------------------------------------------------------------- | View Storage Paths |-------------------------------------------------------------------------- | | Most templating systems load templates from disk. Here you may specify | an array of paths that should be checked for your views. Of course | the usual Laravel view path has already been registered for you. | */ 'paths' => [ resource_path('views'), ], /* |-------------------------------------------------------------------------- | Compiled View Path |-------------------------------------------------------------------------- | | This option determines where all the compiled Blade templates will be | stored for your application. Typically, this is within the storage | directory. However, as usual, you are free to change this value. | */ 'compiled' => env( 'VIEW_COMPILED_PATH', realpath(storage_path('framework/views')) ), ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/database.php
config/database.php
<?php use Illuminate\Support\Str; return [ /* |-------------------------------------------------------------------------- | Default Database Connection Name |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish | to use as your default connection for all database work. Of course | you may use many connections at once using the Database library. | */ 'default' => env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | | Here are each of the database connections setup for your application. | Of course, examples of configuring each database platform that is | supported by Laravel is shown below to make development simple. | | | All database work in Laravel is done through the PHP PDO facilities | so make sure you have the driver for your particular database of | choice installed on your machine before you begin development. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ 'driver' => 'pgsql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, 'schema' => 'public', 'sslmode' => 'prefer', ], 'sqlsrv' => [ 'driver' => 'sqlsrv', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, ], ], /* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run in the database. | */ 'migrations' => 'migrations', /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ 'client' => env('REDIS_CLIENT', 'phpredis'), 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DB', 0), ], 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_CACHE_DB', 1), ], ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/services.php
config/services.php
<?php return [ /* |-------------------------------------------------------------------------- | Third Party Services |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such | as Mailgun, Postmark, AWS and more. This file provides the de facto | location for this type of information, allowing packages to have | a conventional file to locate the various service credentials. | */ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], 'postmark' => [ 'token' => env('POSTMARK_TOKEN'), ], 'ses' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/filesystems.php
config/filesystems.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Filesystem Disk |-------------------------------------------------------------------------- | | Here you may specify the default filesystem disk that should be used | by the framework. The "local" disk, as well as a variety of cloud | based disks are available to your application. Just store away! | */ 'default' => env('FILESYSTEM_DRIVER', 'local'), /* |-------------------------------------------------------------------------- | Default Cloud Filesystem Disk |-------------------------------------------------------------------------- | | Many applications store files both locally and in the cloud. For this | reason, you may specify a default "cloud" driver here. This driver | will be bound as the Cloud disk implementation in the container. | */ 'cloud' => env('FILESYSTEM_CLOUD', 's3'), /* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | | Supported Drivers: "local", "ftp", "sftp", "s3" | */ 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), ], ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/mail.php
config/mail.php
<?php return [ /* |-------------------------------------------------------------------------- | Mail Driver |-------------------------------------------------------------------------- | | Laravel supports both SMTP and PHP's "mail" function as drivers for the | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | | Supported: "smtp", "sendmail", "mailgun", "ses", | "postmark", "log", "array" | */ 'driver' => env('MAIL_DRIVER', 'smtp'), /* |-------------------------------------------------------------------------- | SMTP Host Address |-------------------------------------------------------------------------- | | Here you may provide the host address of the SMTP server used by your | applications. A default option is provided that is compatible with | the Mailgun mail service which will provide reliable deliveries. | */ 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), /* |-------------------------------------------------------------------------- | SMTP Host Port |-------------------------------------------------------------------------- | | This is the SMTP port used by your application to deliver e-mails to | users of the application. Like the host we have set this value to | stay compatible with the Mailgun e-mail application by default. | */ 'port' => env('MAIL_PORT', 587), /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all e-mails sent by your application to be sent from | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | */ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* |-------------------------------------------------------------------------- | E-Mail Encryption Protocol |-------------------------------------------------------------------------- | | Here you may specify the encryption protocol that should be used when | the application send e-mail messages. A sensible default using the | transport layer security protocol should provide great security. | */ 'encryption' => env('MAIL_ENCRYPTION', 'tls'), /* |-------------------------------------------------------------------------- | SMTP Server Username |-------------------------------------------------------------------------- | | If your SMTP server requires a username for authentication, you should | set it here. This will get used to authenticate with your server on | connection. You may also set the "password" value below this one. | */ 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), /* |-------------------------------------------------------------------------- | Sendmail System Path |-------------------------------------------------------------------------- | | When using the "sendmail" driver to send e-mails, we will need to know | the path to where Sendmail lives on this server. A default path has | been provided here, which will work well on most of your systems. | */ 'sendmail' => '/usr/sbin/sendmail -bs', /* |-------------------------------------------------------------------------- | Markdown Mail Settings |-------------------------------------------------------------------------- | | If you are using Markdown based email rendering, you may configure your | theme and component paths here, allowing you to customize the design | of the emails. Or, you may simply stick with the Laravel defaults! | */ 'markdown' => [ 'theme' => 'default', 'paths' => [ resource_path('views/vendor/mail'), ], ], /* |-------------------------------------------------------------------------- | Log Channel |-------------------------------------------------------------------------- | | If you are using the "log" driver, you may specify the logging channel | if you prefer to keep mail messages separate from other log entries | for simpler reading. Otherwise, the default channel will be used. | */ 'log_channel' => env('MAIL_LOG_CHANNEL'), ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/broadcasting.php
config/broadcasting.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Broadcaster |-------------------------------------------------------------------------- | | This option controls the default broadcaster that will be used by the | framework when an event needs to be broadcast. You may set this to | any of the connections defined in the "connections" array below. | | Supported: "pusher", "redis", "log", "null" | */ 'default' => env('BROADCAST_DRIVER', 'null'), /* |-------------------------------------------------------------------------- | Broadcast Connections |-------------------------------------------------------------------------- | | Here you may define all of the broadcast connections that will be used | to broadcast events to other systems or over websockets. Samples of | each available type of connection are provided inside this array. | */ 'connections' => [ 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'useTLS' => true, ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], 'log' => [ 'driver' => 'log', ], 'null' => [ 'driver' => 'null', ], ], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/config/auth.php
config/auth.php
<?php return [ /* |-------------------------------------------------------------------------- | Authentication Defaults |-------------------------------------------------------------------------- | | This option controls the default authentication "guard" and password | reset options for your application. You may change these defaults | as required, but they're a perfect start for most applications. | */ 'defaults' => [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', 'hash' => false, ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, 'throttle' => 60, ], ], /* |-------------------------------------------------------------------------- | Password Confirmation Timeout |-------------------------------------------------------------------------- | | Here you may define the amount of seconds before a password confirmation | times out and the user is prompted to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ 'password_timeout' => 10800, ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/seeds/DatabaseSeeder.php
database/seeds/DatabaseSeeder.php
<?php use App\User; use App\Account; use App\Contact; use App\Organization; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { public function run() { $account = Account::create(['name' => 'Acme Corporation']); factory(User::class)->create([ 'account_id' => $account->id, 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'johndoe@example.com', 'owner' => true, ]); factory(User::class, 5)->create(['account_id' => $account->id]); $organizations = factory(Organization::class, 100) ->create(['account_id' => $account->id]); factory(Contact::class, 100) ->create(['account_id' => $account->id]) ->each(function ($contact) use ($organizations) { $contact->update(['organization_id' => $organizations->random()->id]); }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/factories/ContactFactory.php
database/factories/ContactFactory.php
<?php use Faker\Generator as Faker; $factory->define(App\Contact::class, function (Faker $faker) { return [ 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->unique()->safeEmail, 'phone' => $faker->tollFreePhoneNumber, 'address' => $faker->streetAddress, 'city' => $faker->city, 'region' => $faker->state, 'country' => 'US', 'postal_code' => $faker->postcode, ]; });
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/factories/OrganizationFactory.php
database/factories/OrganizationFactory.php
<?php use Faker\Generator as Faker; $factory->define(App\Organization::class, function (Faker $faker) { return [ 'name' => $faker->company, 'email' => $faker->companyEmail, 'phone' => $faker->tollFreePhoneNumber, 'address' => $faker->streetAddress, 'city' => $faker->city, 'region' => $faker->state, 'country' => 'US', 'postal_code' => $faker->postcode, ]; });
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/factories/UserFactory.php
database/factories/UserFactory.php
<?php use Faker\Generator as Faker; use Illuminate\Support\Str; /* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | This directory should contain each of the model factory definitions for | your application. Factories provide a convenient way to generate new | model instances for testing / seeding your application's database. | */ $factory->define(App\User::class, function (Faker $faker) { return [ 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->unique()->safeEmail, 'password' => 'secret', 'remember_token' => Str::random(10), 'owner' => false, ]; });
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/migrations/2019_03_05_000000_create_contacts_table.php
database/migrations/2019_03_05_000000_create_contacts_table.php
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateContactsTable extends Migration { public function up() { Schema::create('contacts', function (Blueprint $table) { $table->increments('id'); $table->integer('account_id')->index(); $table->integer('organization_id')->nullable()->index(); $table->string('first_name', 25); $table->string('last_name', 25); $table->string('email', 50)->nullable(); $table->string('phone', 50)->nullable(); $table->string('address', 150)->nullable(); $table->string('city', 50)->nullable(); $table->string('region', 50)->nullable(); $table->string('country', 2)->nullable(); $table->string('postal_code', 25)->nullable(); $table->timestamps(); $table->softDeletes(); }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/migrations/2019_03_05_000000_create_password_resets_table.php
database/migrations/2019_03_05_000000_create_password_resets_table.php
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePasswordResetsTable extends Migration { public function up() { Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/migrations/2019_03_05_000000_create_users_table.php
database/migrations/2019_03_05_000000_create_users_table.php
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->integer('account_id')->index(); $table->string('first_name', 25); $table->string('last_name', 25); $table->string('email', 50)->unique(); $table->string('password')->nullable(); $table->boolean('owner')->default(false); $table->string('photo_path', 100)->nullable(); $table->rememberToken(); $table->timestamps(); $table->softDeletes(); }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/migrations/2019_03_05_000000_create_accounts_table.php
database/migrations/2019_03_05_000000_create_accounts_table.php
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateAccountsTable extends Migration { public function up() { Schema::create('accounts', function (Blueprint $table) { $table->increments('id'); $table->string('name', 50); $table->timestamps(); }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/database/migrations/2019_03_05_000000_create_organizations_table.php
database/migrations/2019_03_05_000000_create_organizations_table.php
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateOrganizationsTable extends Migration { public function up() { Schema::create('organizations', function (Blueprint $table) { $table->increments('id'); $table->integer('account_id')->index(); $table->string('name', 100); $table->string('email', 50)->nullable(); $table->string('phone', 50)->nullable(); $table->string('address', 150)->nullable(); $table->string('city', 50)->nullable(); $table->string('region', 50)->nullable(); $table->string('country', 2)->nullable(); $table->string('postal_code', 25)->nullable(); $table->timestamps(); $table->softDeletes(); }); } }
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/resources/lang/en/passwords.php
resources/lang/en/passwords.php
<?php return [ /* |-------------------------------------------------------------------------- | Password Reset Language Lines |-------------------------------------------------------------------------- | | The following language lines are the default lines which match reasons | that are given by the password broker for a password update attempt | has failed, such as for an invalid token or invalid new password. | */ 'password' => 'Passwords must be at least eight characters and match the confirmation.', 'reset' => 'Your password has been reset!', 'sent' => 'We have e-mailed your password reset link!', 'token' => 'This password reset token is invalid.', 'user' => "We can't find a user with that e-mail address.", ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/resources/lang/en/pagination.php
resources/lang/en/pagination.php
<?php return [ /* |-------------------------------------------------------------------------- | Pagination Language Lines |-------------------------------------------------------------------------- | | The following language lines are used by the paginator library to build | the simple pagination links. You are free to change them to anything | you want to customize your views to better match your application. | */ 'previous' => '&laquo; Previous', 'next' => 'Next &raquo;', ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false
zgabievi/pingcrm-svelte
https://github.com/zgabievi/pingcrm-svelte/blob/4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a/resources/lang/en/validation.php
resources/lang/en/validation.php
<?php return [ /* |-------------------------------------------------------------------------- | Validation Language Lines |-------------------------------------------------------------------------- | | The following language lines contain the default error messages used by | the validator class. Some of these rules have multiple versions such | as the size rules. Feel free to tweak each of these messages here. | */ 'accepted' => 'The :attribute must be accepted.', 'active_url' => 'The :attribute is not a valid URL.', 'after' => 'The :attribute must be a date after :date.', 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', 'alpha' => 'The :attribute may only contain letters.', 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', 'alpha_num' => 'The :attribute may only contain letters and numbers.', 'array' => 'The :attribute must be an array.', 'before' => 'The :attribute must be a date before :date.', 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', 'file' => 'The :attribute must be between :min and :max kilobytes.', 'string' => 'The :attribute must be between :min and :max characters.', 'array' => 'The :attribute must have between :min and :max items.', ], 'boolean' => 'The :attribute field must be true or false.', 'confirmed' => 'The :attribute confirmation does not match.', 'date' => 'The :attribute is not a valid date.', 'date_equals' => 'The :attribute must be a date equal to :date.', 'date_format' => 'The :attribute does not match the format :format.', 'different' => 'The :attribute and :other must be different.', 'digits' => 'The :attribute must be :digits digits.', 'digits_between' => 'The :attribute must be between :min and :max digits.', 'dimensions' => 'The :attribute has invalid image dimensions.', 'distinct' => 'The :attribute field has a duplicate value.', 'email' => 'The :attribute must be a valid email address.', 'exists' => 'The selected :attribute is invalid.', 'file' => 'The :attribute must be a file.', 'filled' => 'The :attribute field must have a value.', 'gt' => [ 'numeric' => 'The :attribute must be greater than :value.', 'file' => 'The :attribute must be greater than :value kilobytes.', 'string' => 'The :attribute must be greater than :value characters.', 'array' => 'The :attribute must have more than :value items.', ], 'gte' => [ 'numeric' => 'The :attribute must be greater than or equal :value.', 'file' => 'The :attribute must be greater than or equal :value kilobytes.', 'string' => 'The :attribute must be greater than or equal :value characters.', 'array' => 'The :attribute must have :value items or more.', ], 'image' => 'The :attribute must be an image.', 'in' => 'The selected :attribute is invalid.', 'in_array' => 'The :attribute field does not exist in :other.', 'integer' => 'The :attribute must be an integer.', 'ip' => 'The :attribute must be a valid IP address.', 'ipv4' => 'The :attribute must be a valid IPv4 address.', 'ipv6' => 'The :attribute must be a valid IPv6 address.', 'json' => 'The :attribute must be a valid JSON string.', 'lt' => [ 'numeric' => 'The :attribute must be less than :value.', 'file' => 'The :attribute must be less than :value kilobytes.', 'string' => 'The :attribute must be less than :value characters.', 'array' => 'The :attribute must have less than :value items.', ], 'lte' => [ 'numeric' => 'The :attribute must be less than or equal :value.', 'file' => 'The :attribute must be less than or equal :value kilobytes.', 'string' => 'The :attribute must be less than or equal :value characters.', 'array' => 'The :attribute must not have more than :value items.', ], 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', 'file' => 'The :attribute may not be greater than :max kilobytes.', 'string' => 'The :attribute may not be greater than :max characters.', 'array' => 'The :attribute may not have more than :max items.', ], 'mimes' => 'The :attribute must be a file of type: :values.', 'mimetypes' => 'The :attribute must be a file of type: :values.', 'min' => [ 'numeric' => 'The :attribute must be at least :min.', 'file' => 'The :attribute must be at least :min kilobytes.', 'string' => 'The :attribute must be at least :min characters.', 'array' => 'The :attribute must have at least :min items.', ], 'not_in' => 'The selected :attribute is invalid.', 'not_regex' => 'The :attribute format is invalid.', 'numeric' => 'The :attribute must be a number.', 'present' => 'The :attribute field must be present.', 'regex' => 'The :attribute format is invalid.', 'required' => 'The :attribute field is required.', 'required_if' => 'The :attribute field is required when :other is :value.', 'required_unless' => 'The :attribute field is required unless :other is in :values.', 'required_with' => 'The :attribute field is required when :values is present.', 'required_with_all' => 'The :attribute field is required when :values are present.', 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', 'same' => 'The :attribute and :other must match.', 'size' => [ 'numeric' => 'The :attribute must be :size.', 'file' => 'The :attribute must be :size kilobytes.', 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', ], 'starts_with' => 'The :attribute must start with one of the following: :values', 'string' => 'The :attribute must be a string.', 'timezone' => 'The :attribute must be a valid zone.', 'unique' => 'The :attribute has already been taken.', 'uploaded' => 'The :attribute failed to upload.', 'url' => 'The :attribute format is invalid.', 'uuid' => 'The :attribute must be a valid UUID.', /* |-------------------------------------------------------------------------- | Custom Validation Language Lines |-------------------------------------------------------------------------- | | Here you may specify custom validation messages for attributes using the | convention "attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'custom' => [ 'attribute-name' => [ 'rule-name' => 'custom-message', ], ], /* |-------------------------------------------------------------------------- | Custom Validation Attributes |-------------------------------------------------------------------------- | | The following language lines are used to swap our attribute placeholder | with something more reader friendly such as "E-Mail Address" instead | of "email". This simply helps us make our message more expressive. | */ 'attributes' => [], ];
php
MIT
4bc6d9883123d1b1a2c9b59b4d315d4f1823bf8a
2026-01-05T04:42:55.697447Z
false