Skip to content

Instantly share code, notes, and snippets.

View morrislaptop's full-sized avatar

Craig Morris morrislaptop

View GitHub Profile
<?php
dispatch(function () use ($uuid) {
PostAggregateRoot::retrieve($uuid)
->publish()
->persist();
})->delay($request->publish_date);
<?php
class PostAggregateRoot
{
public function applyPostPublished(PostPublished $event) {
$this->status = 'future';
$this->publishDate = $event->publishDate;
}
public function timeElapsed(DateTime $now) {
<?php
class PostAggregateRoot
{
public function publishPost(DateTime $when) {
$this->recordThat(new PostPublishScheduled($when));
if ($when < now()) {
$this->recordThat(new PostPublished());
}
<?php
class PostAggregateRoot
{
public function publishPost(DateTime $when) {
$this->recordThat(new PostPublishScheduled($when));
if ($when < now()) {
$this->recordThat(new PostPublished());
}
<?php
dispatch(function () use ($uuid) {
PostAggregateRoot::retrieve($uuid)
->publish()
->persist();
})->delay($request->publish_date);
<?php
public function getCurrentStatusAttribute()
{
if ($this->status === 'published') {
return $this->publish_date?->lessThan(now()) ? 'published' : 'future';
}
return $status;
}
<footer class="-sm:text-center">Centered on mobile, back to default for bigger screens</footer>
<img class="-sm:hidden">Hidden only on mobile to save space</img>
<body class="-sm:p-4">Only apply padding on mobile so text isn't hard against the screen</body>
<sidebar class="hidden @md:show">Only this on medium sized screens</sidebar>
const colors = require('tailwindcss/colors')
module.exports = {
theme: {
extend: {
screens: {
'-2xl': { max: '1535px' },
'-xl': { max: '1279px' },
'-lg': { max: '1023px' },
'-md': { max: '767px' },
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $id
* @property int $project_id
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Laravel\Scout\Searchable;
trait BuildBehaviour