Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig Morris morrislaptop

View GitHub Profile
View Post.php
<?php
dispatch(function () use ($uuid) {
PostAggregateRoot::retrieve($uuid)
->publish()
->persist();
})->delay($request->publish_date);
View Post.php
<?php
class PostAggregateRoot
{
public function applyPostPublished(PostPublished $event) {
$this->status = 'future';
$this->publishDate = $event->publishDate;
}
public function timeElapsed(DateTime $now) {
View Post.php
<?php
class PostAggregateRoot
{
public function publishPost(DateTime $when) {
$this->recordThat(new PostPublishScheduled($when));
if ($when < now()) {
$this->recordThat(new PostPublished());
}
View Post.php
<?php
class PostAggregateRoot
{
public function publishPost(DateTime $when) {
$this->recordThat(new PostPublishScheduled($when));
if ($when < now()) {
$this->recordThat(new PostPublished());
}
View Post.php
<?php
dispatch(function () use ($uuid) {
PostAggregateRoot::retrieve($uuid)
->publish()
->persist();
})->delay($request->publish_date);
View Post.php
<?php
public function getCurrentStatusAttribute()
{
if ($this->status === 'published') {
return $this->publish_date?->lessThan(now()) ? 'published' : 'future';
}
return $status;
}
View index.html
<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>
View tailwind.config.js
const colors = require('tailwindcss/colors')
module.exports = {
theme: {
extend: {
screens: {
'-2xl': { max: '1535px' },
'-xl': { max: '1279px' },
'-lg': { max: '1023px' },
'-md': { max: '767px' },
View Build.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $id
* @property int $project_id
View BuildBehaviour.php
<?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