Skip to content

Instantly share code, notes, and snippets.

View JordanDalton's full-sized avatar

Jordan Dalton JordanDalton

View GitHub Profile
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Something extends JsonResource
{
/**
* Transform the resource into an array.
@JordanDalton
JordanDalton / helpers.php
Created February 19, 2023 14:28
Pipeline Helper / Wrapper
<?php
if( ! function_exists('pipe')) {
function pipe($payload, $steps = [])
{
return app(\Illuminate\Pipeline\Pipeline::class)
->send($payload)
->through($steps)
@JordanDalton
JordanDalton / CustomFunctionExample.php
Created July 13, 2023 10:10
Code sample on using custom function in the OpenAI PHP Laravel package.
<?php
$city_fact_result = OpenAI::chat()->create([
'model' => 'gpt-3.5-turbo',
'messages' => [
[
'role' => 'user',
'content' => "I'm in {$location}?",
],[
'role' => 'assistant',