Merge pull request #766 from jonnybarnes/develop

MTM Switch bio to be stored in the database
This commit is contained in:
Jonny Barnes 2023-04-11 17:50:34 +01:00 committed by GitHub
commit 8532ee36d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 344 additions and 163 deletions

View file

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Bio;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class BioController extends Controller
{
public function show(): View
{
$bio = Bio::first();
return view('admin.bio.show', [
'bioEntry' => $bio,
]);
}
public function update(Request $request): RedirectResponse
{
$bio = Bio::firstOrNew();
$bio->content = $request->input('content');
$bio->save();
return redirect()->route('admin.bio.show');
}
}

View file

@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\Article;
use App\Models\Bio;
use App\Models\Bookmark;
use App\Models\Like;
use App\Models\Note;
@ -34,8 +35,11 @@ class FrontPageController extends Controller
->sortByDesc('updated_at')
->paginate(10);
$bio = Bio::first()?->content;
return view('front-page', [
'items' => $items,
'bio' => $bio,
]);
}
}

11
app/Models/Bio.php Normal file
View file

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Bio extends Model
{
use HasFactory;
}

View file

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bio>
*/
class BioFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'content' => $this->faker->paragraph,
];
}
}

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('bios', function (Blueprint $table) {
$table->id();
$table->text('content');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('bios');
}
};

View file

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use App\Models\Bio;
use Illuminate\Database\Seeder;
class BioSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Bio::factory()->create();
}
}

242
package-lock.json generated
View file

@ -11,15 +11,15 @@
"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/preset-env": "^7.21.4",
"@csstools/postcss-oklab-function": "^2.2.0",
"@csstools/postcss-oklab-function": "^2.2.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"browserlist": "^1.0.1",
"compression-webpack-plugin": "^10.0.0",
"css-loader": "^6.7.3",
"cssnano": "^6.0.0",
"eslint": "^8.37.0",
"eslint-webpack-plugin": "^4.0.0",
"eslint": "^8.38.0",
"eslint-webpack-plugin": "^4.0.1",
"mini-css-extract-plugin": "^2.7.5",
"postcss": "^8.4.21",
"postcss-combine-duplicated-selectors": "^10.0.2",
@ -29,7 +29,7 @@
"postcss-nesting": "^11.2.2",
"stylelint": "^15.4.0",
"stylelint-config-standard": "^32.0.0",
"stylelint-webpack-plugin": "^4.1.0",
"stylelint-webpack-plugin": "^4.1.1",
"webpack": "^5.78.0",
"webpack-cli": "^5.0.1"
}
@ -1694,9 +1694,9 @@
}
},
"node_modules/@csstools/css-calc": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-1.0.1.tgz",
"integrity": "sha512-VBI8X0bmStfc85wWTa2bsbnlBQxgW4FmJ0Ts9ar9UqytE6kii3yg6GO+wpgzht2oK5Qlbpkm1Fy2kcqVmu6f3Q==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-1.1.1.tgz",
"integrity": "sha512-Nh+iLCtjlooTzuR0lpmB8I6hPX/VupcGQ3Z1U2+wgJJ4fa8+cWkub+lCsbZcYPzBGsZLEL8fQAg+Na5dwEFJxg==",
"dev": true,
"engines": {
"node": "^14 || ^16 || >=18"
@ -1706,18 +1706,18 @@
"url": "https://opencollective.com/csstools"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^2.0.1",
"@csstools/css-tokenizer": "^2.0.1"
"@csstools/css-parser-algorithms": "^2.1.1",
"@csstools/css-tokenizer": "^2.1.1"
}
},
"node_modules/@csstools/css-color-parser": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-1.0.0.tgz",
"integrity": "sha512-u3JrK+pQIGGnXe+YhohWwAwOum2y25NRdEjRQFD3moMnOJgmU/nj8BPAF6DDQAooy8Ty9RNKiAh2njuqwMgUNQ==",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-1.1.2.tgz",
"integrity": "sha512-MjW/VspbFSkvbuou7tUUu2+FAlAR7VJ/PA69M9EGKltThbONC8nyW33wHRzNvLzRLGstZLEO5X5oR7IMhMDi0A==",
"dev": true,
"dependencies": {
"@csstools/color-helpers": "^2.0.0",
"@csstools/css-calc": "^1.0.1"
"@csstools/css-calc": "^1.1.1"
},
"engines": {
"node": "^14 || ^16 || >=18"
@ -1727,14 +1727,14 @@
"url": "https://opencollective.com/csstools"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^2.1.0",
"@csstools/css-tokenizer": "^2.1.0"
"@csstools/css-parser-algorithms": "^2.1.1",
"@csstools/css-tokenizer": "^2.1.1"
}
},
"node_modules/@csstools/css-parser-algorithms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.0.tgz",
"integrity": "sha512-KP8TicdXpUyeB1NMlbHud/1l39xvLGvqNFWMpG4qC6H1zs9SadGUHe5SO92n/659sDW9aGDvm9AMru0DZkN1Bw==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.1.tgz",
"integrity": "sha512-viRnRh02AgO4mwIQb2xQNJju0i+Fh9roNgmbR5xEuG7J3TGgxjnE95HnBLgsFJOJOksvcfxOUCgODcft6Y07cA==",
"dev": true,
"engines": {
"node": "^14 || ^16 || >=18"
@ -1744,13 +1744,13 @@
"url": "https://opencollective.com/csstools"
},
"peerDependencies": {
"@csstools/css-tokenizer": "^2.0.0"
"@csstools/css-tokenizer": "^2.1.1"
}
},
"node_modules/@csstools/css-tokenizer": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-2.1.0.tgz",
"integrity": "sha512-dtqFyoJBHUxGi9zPZdpCKP1xk8tq6KPHJ/NY4qWXiYo6IcSGwzk3L8x2XzZbbyOyBs9xQARoGveU2AsgLj6D2A==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-2.1.1.tgz",
"integrity": "sha512-GbrTj2Z8MCTUv+52GE0RbFGM527xuXZ0Xa5g0Z+YN573uveS4G0qi6WNOMyz3yrFM/jaILTTwJ0+umx81EzqfA==",
"dev": true,
"engines": {
"node": "^14 || ^16 || >=18"
@ -1778,14 +1778,14 @@
}
},
"node_modules/@csstools/postcss-oklab-function": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@csstools/postcss-oklab-function/-/postcss-oklab-function-2.2.0.tgz",
"integrity": "sha512-5QMtgn9IWpeTbbt8DwLvr41CQRJef2fKhznTFQI1Og/v3zr/uKYu+aSKZEEaoZnO9OophM4YJnkVJne3CqvJDQ==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@csstools/postcss-oklab-function/-/postcss-oklab-function-2.2.1.tgz",
"integrity": "sha512-g4wrVopp6xXr1KetUK4Lj36P+PFPwvUUtd2gaqo7X/0xgJHmMtKMPhD9p77H9bmIpPtkIYQ8b7+7cdmrWNEVAw==",
"dev": true,
"dependencies": {
"@csstools/css-color-parser": "^1.0.0",
"@csstools/css-parser-algorithms": "^2.0.1",
"@csstools/css-tokenizer": "^2.1.0",
"@csstools/css-color-parser": "^1.1.2",
"@csstools/css-parser-algorithms": "^2.1.1",
"@csstools/css-tokenizer": "^2.1.1",
"@csstools/postcss-progressive-custom-properties": "^2.0.0"
},
"engines": {
@ -1918,9 +1918,9 @@
}
},
"node_modules/@eslint/js": {
"version": "8.37.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.37.0.tgz",
"integrity": "sha512-x5vzdtOOGgFVDCUs81QRB2+liax8rFg3+7hqM+QhBG0/G3F1ZsoYl97UrqgHgQ9KKT7G6c4V+aTUCgu/n22v1A==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz",
"integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -1972,9 +1972,9 @@
}
},
"node_modules/@jest/types": {
"version": "29.4.3",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.3.tgz",
"integrity": "sha512-bPYfw8V65v17m2Od1cv44FH+SiKW7w2Xu7trhcdTLUmSv85rfKsP+qXSjO4KGJr4dtPSzl/gvslZBXctf1qGEA==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz",
"integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==",
"dev": true,
"dependencies": {
"@jest/schemas": "^29.4.3",
@ -2208,9 +2208,9 @@
"peer": true
},
"node_modules/@types/eslint": {
"version": "8.21.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.21.0.tgz",
"integrity": "sha512-35EhHNOXgxnUgh4XCJsGhE7zdlDhYDN/aMG6UbkByCFFNgQ7b3U+uVoqBpicFydR8JEfgdjCF7SJ7MiJfzuiTA==",
"version": "8.37.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.37.0.tgz",
"integrity": "sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ==",
"dev": true,
"dependencies": {
"@types/estree": "*",
@ -2282,9 +2282,9 @@
"dev": true
},
"node_modules/@types/yargs": {
"version": "17.0.22",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz",
"integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==",
"version": "17.0.24",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz",
"integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==",
"dev": true,
"dependencies": {
"@types/yargs-parser": "*"
@ -3553,15 +3553,15 @@
}
},
"node_modules/eslint": {
"version": "8.37.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.37.0.tgz",
"integrity": "sha512-NU3Ps9nI05GUoVMxcZx1J8CNR6xOvUT4jAUMH5+z8lpp3aEdPVCImKw6PWG4PY+Vfkpr+jvMpxs/qoE7wq0sPw==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz",
"integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.4.0",
"@eslint/eslintrc": "^2.0.2",
"@eslint/js": "8.37.0",
"@eslint/js": "8.38.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@ -3635,13 +3635,13 @@
}
},
"node_modules/eslint-webpack-plugin": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-4.0.0.tgz",
"integrity": "sha512-eM9ccGRWkU+btBSVfABRn8CjT7jZ2Q+UV/RfErMDVCFXpihEbvajNrLltZpwTAcEoXSqESGlEPIUxl7PoDlLWw==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-4.0.1.tgz",
"integrity": "sha512-fUFcXpui/FftGx3NzvWgLZXlLbu+m74sUxGEgxgoxYcUtkIQbS6SdNNZkS99m5ycb23TfoNYrDpp1k/CK5j6Hw==",
"dev": true,
"dependencies": {
"@types/eslint": "^8.4.10",
"jest-worker": "^29.4.1",
"@types/eslint": "^8.37.0",
"jest-worker": "^29.5.0",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"schema-utils": "^4.0.0"
@ -3668,13 +3668,13 @@
}
},
"node_modules/eslint-webpack-plugin/node_modules/jest-worker": {
"version": "29.4.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz",
"integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz",
"integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==",
"dev": true,
"dependencies": {
"@types/node": "*",
"jest-util": "^29.4.1",
"jest-util": "^29.5.0",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
},
@ -4497,12 +4497,12 @@
}
},
"node_modules/jest-util": {
"version": "29.4.3",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.3.tgz",
"integrity": "sha512-ToSGORAz4SSSoqxDSylWX8JzkOQR7zoBtNRsA7e+1WUX5F8jrOwaNpuh1YfJHJKDHXLHmObv5eOjejUd+/Ws+Q==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz",
"integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==",
"dev": true,
"dependencies": {
"@jest/types": "^29.4.3",
"@jest/types": "^29.5.0",
"@types/node": "*",
"chalk": "^4.0.0",
"ci-info": "^3.2.0",
@ -6647,13 +6647,13 @@
}
},
"node_modules/stylelint-webpack-plugin": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/stylelint-webpack-plugin/-/stylelint-webpack-plugin-4.1.0.tgz",
"integrity": "sha512-Vm8H2uYflIiF9m4BjSBEn9cpqY2zZ0wDHgBxOVM6aWFDd0FvfNoymrSYYOIG5/ZST0NO/0NCXPWcpRVpv79Uew==",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/stylelint-webpack-plugin/-/stylelint-webpack-plugin-4.1.1.tgz",
"integrity": "sha512-yOyd2AfrxfawxKDememazGVJX2vMq9o11E6HvBu4+SKvgK3ZulkjpYdI1muBTxItwoxH2UmfIZzQM+/M5V3kTQ==",
"dev": true,
"dependencies": {
"globby": "^11.1.0",
"jest-worker": "^29.4.2",
"jest-worker": "^29.5.0",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"schema-utils": "^4.0.0"
@ -6680,13 +6680,13 @@
}
},
"node_modules/stylelint-webpack-plugin/node_modules/jest-worker": {
"version": "29.4.3",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.3.tgz",
"integrity": "sha512-GLHN/GTAAMEy5BFdvpUfzr9Dr80zQqBrh0fz1mtRMe05hqP45+HfQltu7oTBfduD0UeZs09d+maFtFYAXFWvAA==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz",
"integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==",
"dev": true,
"dependencies": {
"@types/node": "*",
"jest-util": "^29.4.3",
"jest-util": "^29.5.0",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
},
@ -8587,33 +8587,33 @@
"dev": true
},
"@csstools/css-calc": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-1.0.1.tgz",
"integrity": "sha512-VBI8X0bmStfc85wWTa2bsbnlBQxgW4FmJ0Ts9ar9UqytE6kii3yg6GO+wpgzht2oK5Qlbpkm1Fy2kcqVmu6f3Q==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-1.1.1.tgz",
"integrity": "sha512-Nh+iLCtjlooTzuR0lpmB8I6hPX/VupcGQ3Z1U2+wgJJ4fa8+cWkub+lCsbZcYPzBGsZLEL8fQAg+Na5dwEFJxg==",
"dev": true,
"requires": {}
},
"@csstools/css-color-parser": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-1.0.0.tgz",
"integrity": "sha512-u3JrK+pQIGGnXe+YhohWwAwOum2y25NRdEjRQFD3moMnOJgmU/nj8BPAF6DDQAooy8Ty9RNKiAh2njuqwMgUNQ==",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-1.1.2.tgz",
"integrity": "sha512-MjW/VspbFSkvbuou7tUUu2+FAlAR7VJ/PA69M9EGKltThbONC8nyW33wHRzNvLzRLGstZLEO5X5oR7IMhMDi0A==",
"dev": true,
"requires": {
"@csstools/color-helpers": "^2.0.0",
"@csstools/css-calc": "^1.0.1"
"@csstools/css-calc": "^1.1.1"
}
},
"@csstools/css-parser-algorithms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.0.tgz",
"integrity": "sha512-KP8TicdXpUyeB1NMlbHud/1l39xvLGvqNFWMpG4qC6H1zs9SadGUHe5SO92n/659sDW9aGDvm9AMru0DZkN1Bw==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.1.tgz",
"integrity": "sha512-viRnRh02AgO4mwIQb2xQNJju0i+Fh9roNgmbR5xEuG7J3TGgxjnE95HnBLgsFJOJOksvcfxOUCgODcft6Y07cA==",
"dev": true,
"requires": {}
},
"@csstools/css-tokenizer": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-2.1.0.tgz",
"integrity": "sha512-dtqFyoJBHUxGi9zPZdpCKP1xk8tq6KPHJ/NY4qWXiYo6IcSGwzk3L8x2XzZbbyOyBs9xQARoGveU2AsgLj6D2A==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-2.1.1.tgz",
"integrity": "sha512-GbrTj2Z8MCTUv+52GE0RbFGM527xuXZ0Xa5g0Z+YN573uveS4G0qi6WNOMyz3yrFM/jaILTTwJ0+umx81EzqfA==",
"dev": true
},
"@csstools/media-query-list-parser": {
@ -8624,14 +8624,14 @@
"requires": {}
},
"@csstools/postcss-oklab-function": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@csstools/postcss-oklab-function/-/postcss-oklab-function-2.2.0.tgz",
"integrity": "sha512-5QMtgn9IWpeTbbt8DwLvr41CQRJef2fKhznTFQI1Og/v3zr/uKYu+aSKZEEaoZnO9OophM4YJnkVJne3CqvJDQ==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@csstools/postcss-oklab-function/-/postcss-oklab-function-2.2.1.tgz",
"integrity": "sha512-g4wrVopp6xXr1KetUK4Lj36P+PFPwvUUtd2gaqo7X/0xgJHmMtKMPhD9p77H9bmIpPtkIYQ8b7+7cdmrWNEVAw==",
"dev": true,
"requires": {
"@csstools/css-color-parser": "^1.0.0",
"@csstools/css-parser-algorithms": "^2.0.1",
"@csstools/css-tokenizer": "^2.1.0",
"@csstools/css-color-parser": "^1.1.2",
"@csstools/css-parser-algorithms": "^2.1.1",
"@csstools/css-tokenizer": "^2.1.1",
"@csstools/postcss-progressive-custom-properties": "^2.0.0"
}
},
@ -8707,9 +8707,9 @@
}
},
"@eslint/js": {
"version": "8.37.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.37.0.tgz",
"integrity": "sha512-x5vzdtOOGgFVDCUs81QRB2+liax8rFg3+7hqM+QhBG0/G3F1ZsoYl97UrqgHgQ9KKT7G6c4V+aTUCgu/n22v1A==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz",
"integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==",
"dev": true
},
"@humanwhocodes/config-array": {
@ -8745,9 +8745,9 @@
}
},
"@jest/types": {
"version": "29.4.3",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.3.tgz",
"integrity": "sha512-bPYfw8V65v17m2Od1cv44FH+SiKW7w2Xu7trhcdTLUmSv85rfKsP+qXSjO4KGJr4dtPSzl/gvslZBXctf1qGEA==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz",
"integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==",
"dev": true,
"requires": {
"@jest/schemas": "^29.4.3",
@ -8937,9 +8937,9 @@
"peer": true
},
"@types/eslint": {
"version": "8.21.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.21.0.tgz",
"integrity": "sha512-35EhHNOXgxnUgh4XCJsGhE7zdlDhYDN/aMG6UbkByCFFNgQ7b3U+uVoqBpicFydR8JEfgdjCF7SJ7MiJfzuiTA==",
"version": "8.37.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.37.0.tgz",
"integrity": "sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ==",
"dev": true,
"requires": {
"@types/estree": "*",
@ -9011,9 +9011,9 @@
"dev": true
},
"@types/yargs": {
"version": "17.0.22",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz",
"integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==",
"version": "17.0.24",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz",
"integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
@ -9952,15 +9952,15 @@
"dev": true
},
"eslint": {
"version": "8.37.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.37.0.tgz",
"integrity": "sha512-NU3Ps9nI05GUoVMxcZx1J8CNR6xOvUT4jAUMH5+z8lpp3aEdPVCImKw6PWG4PY+Vfkpr+jvMpxs/qoE7wq0sPw==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz",
"integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.4.0",
"@eslint/eslintrc": "^2.0.2",
"@eslint/js": "8.37.0",
"@eslint/js": "8.38.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@ -10125,13 +10125,13 @@
"dev": true
},
"eslint-webpack-plugin": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-4.0.0.tgz",
"integrity": "sha512-eM9ccGRWkU+btBSVfABRn8CjT7jZ2Q+UV/RfErMDVCFXpihEbvajNrLltZpwTAcEoXSqESGlEPIUxl7PoDlLWw==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-4.0.1.tgz",
"integrity": "sha512-fUFcXpui/FftGx3NzvWgLZXlLbu+m74sUxGEgxgoxYcUtkIQbS6SdNNZkS99m5ycb23TfoNYrDpp1k/CK5j6Hw==",
"dev": true,
"requires": {
"@types/eslint": "^8.4.10",
"jest-worker": "^29.4.1",
"@types/eslint": "^8.37.0",
"jest-worker": "^29.5.0",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"schema-utils": "^4.0.0"
@ -10144,13 +10144,13 @@
"dev": true
},
"jest-worker": {
"version": "29.4.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz",
"integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz",
"integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==",
"dev": true,
"requires": {
"@types/node": "*",
"jest-util": "^29.4.1",
"jest-util": "^29.5.0",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
}
@ -10635,12 +10635,12 @@
"dev": true
},
"jest-util": {
"version": "29.4.3",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.3.tgz",
"integrity": "sha512-ToSGORAz4SSSoqxDSylWX8JzkOQR7zoBtNRsA7e+1WUX5F8jrOwaNpuh1YfJHJKDHXLHmObv5eOjejUd+/Ws+Q==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz",
"integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==",
"dev": true,
"requires": {
"@jest/types": "^29.4.3",
"@jest/types": "^29.5.0",
"@types/node": "*",
"chalk": "^4.0.0",
"ci-info": "^3.2.0",
@ -12179,13 +12179,13 @@
}
},
"stylelint-webpack-plugin": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/stylelint-webpack-plugin/-/stylelint-webpack-plugin-4.1.0.tgz",
"integrity": "sha512-Vm8H2uYflIiF9m4BjSBEn9cpqY2zZ0wDHgBxOVM6aWFDd0FvfNoymrSYYOIG5/ZST0NO/0NCXPWcpRVpv79Uew==",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/stylelint-webpack-plugin/-/stylelint-webpack-plugin-4.1.1.tgz",
"integrity": "sha512-yOyd2AfrxfawxKDememazGVJX2vMq9o11E6HvBu4+SKvgK3ZulkjpYdI1muBTxItwoxH2UmfIZzQM+/M5V3kTQ==",
"dev": true,
"requires": {
"globby": "^11.1.0",
"jest-worker": "^29.4.2",
"jest-worker": "^29.5.0",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"schema-utils": "^4.0.0"
@ -12198,13 +12198,13 @@
"dev": true
},
"jest-worker": {
"version": "29.4.3",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.3.tgz",
"integrity": "sha512-GLHN/GTAAMEy5BFdvpUfzr9Dr80zQqBrh0fz1mtRMe05hqP45+HfQltu7oTBfduD0UeZs09d+maFtFYAXFWvAA==",
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz",
"integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==",
"dev": true,
"requires": {
"@types/node": "*",
"jest-util": "^29.4.3",
"jest-util": "^29.5.0",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
}

View file

@ -7,15 +7,15 @@
"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/preset-env": "^7.21.4",
"@csstools/postcss-oklab-function": "^2.2.0",
"@csstools/postcss-oklab-function": "^2.2.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"browserlist": "^1.0.1",
"compression-webpack-plugin": "^10.0.0",
"css-loader": "^6.7.3",
"cssnano": "^6.0.0",
"eslint": "^8.37.0",
"eslint-webpack-plugin": "^4.0.0",
"eslint": "^8.38.0",
"eslint-webpack-plugin": "^4.0.1",
"mini-css-extract-plugin": "^2.7.5",
"postcss": "^8.4.21",
"postcss-combine-duplicated-selectors": "^10.0.2",
@ -25,7 +25,7 @@
"postcss-nesting": "^11.2.2",
"stylelint": "^15.4.0",
"stylelint-config-standard": "^32.0.0",
"stylelint-webpack-plugin": "^4.1.0",
"stylelint-webpack-plugin": "^4.1.1",
"webpack": "^5.78.0",
"webpack-cli": "^5.0.1"
},

View file

@ -0,0 +1,19 @@
@extends('master')
@section('title')Edit Bio « Admin CP « @stop
@section('content')
<h1>Edit bio</h1>
<form action="/admin/bio" method="post" accept-charset="utf-8" class="admin-form form">
{{ csrf_field() }}
{{ method_field('PUT') }}
<div>
<label for="content">Content:</label>
<br>
<textarea name="content" id="content" rows="10" cols="50">{{ old('content', $bioEntry?->content) }}</textarea>
</div>
<div>
<button type="submit" name="save">Save</button>
</div>
</form>
@stop

View file

@ -46,4 +46,9 @@
You can either <a href="/admin/syndication/create">create</a> new syndication targets,
or <a href="/admin/syndication">edit</a> them.
</p>
<h2>Bio</h2>
<p>
Edit your <a href="/admin/bio">bio</a>.
</p>
@stop

View file

@ -27,6 +27,4 @@
</div>
{{ $items->links('templates.pagination') }}
@include('templates.bio')
@stop

View file

@ -43,9 +43,11 @@
</header>
<main>
@yield('content')
@section('bio')
@show
@yield('content')
@isset($bio)
{!! $bio !!}
@endisset
</main>
<footer>

View file

@ -1,32 +0,0 @@
@section('bio')
<div class="h-card personal-bio">
<p>My name is <span class="p-name p-author">Jonny Barnes</span>, and
<a rel="me" href="https://jonnybarnes.uk" class="u-url">
<code>jonnybarnes.uk</code>
</a> is my site. Im from
<a href="https://en.wikipedia.org/wiki/Manchester" class="h-adr p-adr">
<span class="p-locality">Manchester</span>,
<abbr class="p-country-name" title="United Kingdom">UK</abbr>
</a>.</p>
<p>I am active to varying degrees on several
<a href="https://indieweb.org/silo">silos</a>:</p>
<ul>
<li>I keep in touch with friends on <a rel="me" href="https://www.facebook.com/jonnybarnes" class="u-url">Facebook</a></li>
<li>I follow people I find interesting on <a rel="me" href="https://twitter.com/jonnybarnes" class="u-url">Twitter</a></li>
<li>I toot on the fediverse with my own instance of <a rel="me" href="https://mastodon.thebeeches.house/@jonny" class="u-url">Mastodon</a></li>
<li>I push code to <a rel="me" href="https://github.com/jonnybarnes" class="u-url">GitHub</a></li>
<li>I scrobble songs to <a rel="me" href="https://last.fm/user/jonnymbarnes" class="u-url">last.fm</a> that I listen to on <a rel="me" href="https://open.spotify.com/user/jonnybarnes89" class="u-url">Spotify</a> or <a rel="me" href="https://music.apple.com/profile/jonnybarnes" class="u-url">Apple Music</a></li>
<li>I post photos to <a rel="me" href="https://www.instagram.com/jonnybarnes/" class="u-url">Instagram</a></li>
</ul>
<p>My usual online nickname is normally <code class="nickname">
jonnybarnes</code> for other services. I also syndicate my content
to the IndieWeb friendly site
<a rel="me" href="https://micro.blog/jonnybarnes" class="u-url">micro.blog</a>.
Heres a <a href="/assets/img/jmb-bw.png" class="u-photo photo">
profile pic</a>. I also have a
<a class="pgpkey" href="/assets/jonnybarnes-public-key-ecc.asc">PGP
key</a>, with <a href="/notes/5g">fingerprint</a>. You can email me
at jonny at my domain, or message me on
<a href="xmpp:jonny@chat.jonnybarnes.uk">XMPP</a>.</p>
</div>
@stop

View file

@ -12,6 +12,7 @@
*/
use App\Http\Controllers\Admin\ArticlesController as AdminArticlesController;
use App\Http\Controllers\Admin\BioController;
use App\Http\Controllers\Admin\ClientsController;
use App\Http\Controllers\Admin\ContactsController as AdminContactsController;
use App\Http\Controllers\Admin\HomeController;
@ -133,6 +134,12 @@ Route::group(['domain' => config('url.longurl')], function () {
Route::put('/{syndicationTarget}', [SyndicationTargetsController::class, 'update']);
Route::delete('/{syndicationTarget}', [SyndicationTargetsController::class, 'destroy']);
});
// Bio
Route::group(['prefix' => 'bio'], function () {
Route::get('/', [BioController::class, 'show'])->name('admin.bio.show');
Route::put('/', [BioController::class, 'update']);
});
});
// Blog pages using ArticlesController

View file

@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\Admin;
use App\Models\Bio;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class BioTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function adminBiosPageLoads(): void
{
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/bio');
$response->assertSeeText('Edit bio');
}
/** @test */
public function adminCanCreateBio(): void
{
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/bio', [
'_method' => 'PUT',
'content' => 'Bio content',
]);
$this->assertDatabaseHas('bios', ['content' => 'Bio content']);
}
/** @test */
public function adminCanLoadExistingBio(): void
{
$user = User::factory()->make();
$bio = Bio::factory()->create([
'content' => 'This is <em>my</em> bio. It uses <strong>HTML</strong>.',
]);
$response = $this->actingAs($user)
->get('/admin/bio');
$response->assertSeeText('This is <em>my</em> bio. It uses <strong>HTML</strong>.');
}
/** @test */
public function adminCanEditBio(): void
{
$user = User::factory()->make();
$bio = Bio::factory()->create();
$this->actingAs($user)
->post('/admin/bio', [
'_method' => 'PUT',
'content' => 'This bio has been edited',
]);
$this->assertDatabaseHas('bios', [
'content' => 'This bio has been edited',
]);
}
}

View file

@ -412,7 +412,7 @@ class NotesTest extends TestCase
'in_reply_to' => 'https://twitter.com/someRando/status/933662564587855877',
]);
$this->assertSame($tempContent, $note->twitter);
$this->assertEquals($tempContent, $note->twitter);
}
/** @test */