This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Illuminate\Support\Facades\Auth; | |
use Illuminate\Support\Facades\Storage; | |
use Illuminate\Support\Facades\Response; | |
function getFile($fileName) | |
{ | |
// Check if the user is logged in | |
if (!Auth::check()) { | |
return response('Unauthorized', 401); // Return an unauthorized response | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Unit; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
use Tests\TestCase; | |
use App\Models\Post; | |
class PostTest extends TestCase | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let colorsSizes = [["Red","Blue","Black"],["M","L","XL"]]; | |
for (let i = 0; i < colorsSizes[0].length; i++) { | |
for (let j = 0; j < colorsSizes[1].length; j++) { | |
console.log(colorsSizes[0][i] + " - " + colorsSizes[1][j]); | |
} | |
} | |
Red - M | |
Red - L | |
Red - XL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install supervisor | |
sudo systemctl stop supervisor | |
sudo systemctl start supervisor | |
sudo systemctl status supervisor | |
sudo nano /etc/supervisor/conf.d/laravel-queue-project1.conf | |
[program:laravel-queue-project1] | |
process_name=%(program_name)s_%(process_num)02d | |
command=php /var/www/project1/artisan queue:work --queue=default --sleep=3 --tries=3 --max-time=3600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- build | |
- test | |
- deploy | |
variables: | |
APP_NAME: "your-app-name" | |
SERVER_USER: "your-server-user" | |
SERVER_HOST: "your-server-host" | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////project composer.json//////////// | |
{ | |
"name": "laravel/laravel", | |
"type": "project", | |
"description": "The skeleton application for the Laravel framework.", | |
"keywords": ["laravel", "framework"], | |
"license": "MIT", | |
"repositories": { | |
"demo-package": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @return JsonResponse | |
* @throws \Exception | |
*/ | |
public function index(Request $request) | |
{ | |
if ($request->ajax()) { | |
$data = Contact::with(['user'])->where('created_by', self::getUserId()) | |
->orderBy('created_at', 'desc'); | |
return Datatables::of($data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$template = "I am {{name}}, and I work for {{company}}. I am {{age}} years old."; | |
# Your template tags + replacements | |
$replacements = array( | |
'name' => 'Jeffrey', | |
'company' => 'Microsoft Inc Pvt Ltd.', | |
'age' => 27 | |
); | |
function bind_to_template($replacements, $template) { |
NewerOlder