Add more styles and test the site.
This commit is contained in:
parent
f40be66381
commit
7805ce9f80
49
app/db/migrations/20240624022427_create_images_table.php
Normal file
49
app/db/migrations/20240624022427_create_images_table.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
/*
|
||||
CREATE TABLE images (
|
||||
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
url TEXT NOT NULL,
|
||||
title TEXT NULL,
|
||||
width INT(11) UNSIGNED NULL,
|
||||
height INT(11) UNSIGNED NULL,
|
||||
|
||||
PRIMARY KEY(`id`),
|
||||
UNIQUE KEY(`url`)
|
||||
);
|
||||
*/
|
||||
|
||||
final class CreateImagesTable extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change(): void
|
||||
{
|
||||
$table = $this->table('images')->addTimestamps();
|
||||
$table->addColumn('url', 'string')
|
||||
->addColumn('title', 'string', [ 'null' => false ])
|
||||
->addColumn('width', 'integer', [
|
||||
'null' => true,
|
||||
'signed' => false,
|
||||
])
|
||||
->addColumn('height', 'integer', [
|
||||
'null' => true,
|
||||
'signed' => false
|
||||
])
|
||||
->addIndex([ 'url' ], [ 'type' => 'unique' ])
|
||||
->create();
|
||||
}
|
||||
}
|
@ -41,6 +41,12 @@ main {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.error {
|
||||
padding: 0.5em;
|
||||
border: 1px solid #140505;
|
||||
background-color: #C32727;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: right;
|
||||
padding: 0.25em 1em;
|
||||
|
@ -52,7 +52,7 @@ class ChannelRepository implements ChannelRepositoryInterface
|
||||
$statement->execute([ ':id' => $id ]);
|
||||
$results = $statement->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if (!count($results)) {
|
||||
if (!is_array($results) || !count($results)) {
|
||||
throw new EntityNotFoundException("Unable to find Channel");
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class ChannelRepository implements ChannelRepositoryInterface
|
||||
$statement->execute([ ':id' => $user->getId() ]);
|
||||
$results = $statement->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if (!count($results)) {
|
||||
if (!is_array($results) || !count($results)) {
|
||||
throw new EntityNotFoundException("Unable to find Channel");
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class ChannelRepository implements ChannelRepositoryInterface
|
||||
$statement->execute([ ':slug' => $slug ]);
|
||||
$results = $statement->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if (!count($results)) {
|
||||
if (!is_array($results) || !count($results)) {
|
||||
throw new EntityNotFoundException("Unable to find Channel");
|
||||
}
|
||||
|
||||
|
3
dev/php/migrations.sh
Normal file
3
dev/php/migrations.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
composer run phinx migrate -e development
|
Loading…
Reference in New Issue
Block a user