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
create table users (id int); | |
create table posts (id int, user_id int); | |
create table articles (id int, user_id int); | |
insert into users values (1), (2), (3), (4); -- Creating 4 users | |
insert into posts values (1, 2); -- Creating posts for user_id=2 ONLY | |
insert into articles values (1, 2); -- Creating articles for user_id=2 ONLY | |
select | |
id as 'user_id', |
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
[ | |
{ | |
"role": "system", | |
"content": "You are a bot that generates Laravel Tests for given input files. You are an expert in your field. You prioritize standardization and consistency." | |
}, | |
{ | |
"role": "user", | |
"content": "I will provide to you a series of input files. I need you to generate a single Laravel test class as your output. Please put the contents of the generated test f | |
ile in a JSON object with the key: \"test_class\". Please also generate a file name for the test class and put it in the JSON object with the key: \"file_name\"." | |
}, |
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 App\Models; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Schema\Blueprint; | |
use Orbit\Concerns\Orbital; | |
class Category extends Model | |
{ |
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 | |
return [ | |
'slack' => [ | |
'driver' => 'slack', | |
'url' => env('LOG_SLACK_WEBHOOK_URL'), | |
'username' => 'Oh See Snaps', | |
'emoji' => ':boom:', | |
'level' => 'error' | |
], |
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
addEventListener("fetch", (event) => { | |
event.respondWith( | |
handleRequest(event.request).catch( | |
(err) => new Response(err.stack, { status: 500 }) | |
) | |
); | |
}); | |
async function handleRequest(request) { | |
const { search } = new URL(request.url); |
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
addEventListener("fetch", (event) => { | |
event.respondWith( | |
handleRequest(event.request).catch( | |
(err) => new Response(err.stack, { status: 500 }) | |
) | |
); | |
}); | |
async function handleRequest(request) { | |
const { search } = new URL(request.url); |
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 App\Models\Traits; | |
trait TemporaryRelationships | |
{ | |
/** | |
* Returns the value of the given relationship from the current model. | |
* | |
* If the relation is already loaded, it is returned directly. |
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
$authorIds = [1, 2]; | |
Post::whereHas('authors', function ($query, $authorIds) { | |
$query->whereIn('id', $authorIds); | |
}, '=', count($authorIds))->get(); |
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
services: | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_USER: laravel_user | |
MYSQL_PASSWORD: laravel_pass | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: laravel_db | |
ports: | |
- 3306:3306 |
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
// Vue 2 | |
npm install --save-dev vite vite-plugin-vue2 dotenv @vue/compiler-sfc | |
// Vue 3 | |
npm install --save-dev vite @vitejs/plugin-vue dotenv @vue/compiler-sfc |
NewerOlder