diff options
| author | grothedev <grothedev@gmail.com> | 2026-03-06 11:14:32 -0600 |
|---|---|---|
| committer | grothedev <grothedev@gmail.com> | 2026-03-06 11:14:32 -0600 |
| commit | 11e296dc247d2f7d15fe677c0b1b3be659cc135d (patch) | |
| tree | 9d2ee95dfc064f7c348f33ffe462cd71957303ac | |
| parent | 4e4827e9f5ef58085e032a88276dc8ae2b4462b0 (diff) | |
clean up unused stuff. though i want to hold on to the idea i was working with
20 files changed, 81 insertions, 333 deletions
diff --git a/app/Http/Controllers/InventoryController.php b/app/Http/Controllers/InventoryController.php deleted file mode 100644 index 267a032..0000000 --- a/app/Http/Controllers/InventoryController.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace App\Http\Controllers; - -use App\Models\Inventory; -use Illuminate\Http\Request; - -class InventoryController extends Controller -{ - /** - * Display a listing of the resource. - */ - public function index() - { - // - } - - /** - * Show the form for creating a new resource. - */ - public function create() - { - // - } - - /** - * Store a newly created resource in storage. - */ - public function store(Request $request) - { - // - } - - /** - * Display the specified resource. - */ - public function show(Inventory $inventory) - { - // - } - - /** - * Show the form for editing the specified resource. - */ - public function edit(Inventory $inventory) - { - // - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, Inventory $inventory) - { - // - } - - /** - * Remove the specified resource from storage. - */ - public function destroy(Inventory $inventory) - { - // - } -} diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php deleted file mode 100644 index 6b049c9..0000000 --- a/app/Http/Controllers/ItemController.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace App\Http\Controllers; - -use App\Models\Item; -use Illuminate\Http\Request; - -class ItemController extends Controller -{ - /** - * Display a listing of the resource. - */ - public function index() - { - // - } - - /** - * Show the form for creating a new resource. - */ - public function create() - { - // - } - - /** - * Store a newly created resource in storage. - */ - public function store(Request $request) - { - // - } - - /** - * Display the specified resource. - */ - public function show(Item $item) - { - // - } - - /** - * Show the form for editing the specified resource. - */ - public function edit(Item $item) - { - // - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, Item $item) - { - // - } - - /** - * Remove the specified resource from storage. - */ - public function destroy(Item $item) - { - // - } -} diff --git a/app/Http/Controllers/LinkController.php b/app/Http/Controllers/LinkController.php index 180e6e6..9ac44d8 100644 --- a/app/Http/Controllers/LinkController.php +++ b/app/Http/Controllers/LinkController.php @@ -34,11 +34,7 @@ class LinkController extends Controller */ public function store(StoreLinkRequest $req) { - //TODO tag ids - $validated = $req->validate([ - 'label' => 'min:2|max:255', - 'url' => 'min:3' - ]); + $validated = $req->validated(); $link = Link::create([ 'label' => $validated['label'], 'url' => $validated['url'], @@ -74,12 +70,7 @@ class LinkController extends Controller */ public function update(UpdateLinkRequest $request, Link $link) { - $validated = $request->validate([ - 'label' => 'min:2|max:255', - 'url' => 'min:3', - 'description' => 'nullable|string', - ]); - + $validated = $request->validated(); $link->update($validated); $redirect = $request->input('_redirect', route('l.index')); diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 0d6aa6c..33d7dc3 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -6,7 +6,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; -use Storage; +use Illuminate\Support\Facades\Storage; use Carbon\Carbon; class SiteController extends Controller @@ -18,10 +18,7 @@ class SiteController extends Controller 'Link', 'Tag', 'Writing', - 'Inventory', - 'Item', 'Role', - 'Transaction' ]; public static $MODELS_LC_PLURAL = [ 'users', @@ -29,10 +26,7 @@ class SiteController extends Controller 'links', 'tags', 'writings', - 'inventories', - 'items', 'roles', - 'transactions' ]; //returns an env mapping to be used by client. pretty much a subset of laravel app's env, but might also have addition things @@ -83,7 +77,7 @@ class SiteController extends Controller foreach ($files as $f){ $filename = $f->getClientOriginalName(); - if (Storage::disk('public')->fileExists("${dir}/${filename}")){ + if (Storage::disk('public')->exists("${dir}/${filename}")){ $filename = Carbon::now()->timestamp.'_'.$filename; } $path = $f->storeAs( diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php deleted file mode 100644 index 2d9f3c3..0000000 --- a/app/Http/Controllers/TransactionController.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace App\Http\Controllers; - -use App\Models\Transaction; -use Illuminate\Http\Request; - -class TransactionController extends Controller -{ - /** - * Display a listing of the resource. - */ - public function index() - { - // - } - - /** - * Show the form for creating a new resource. - */ - public function create() - { - // - } - - /** - * Store a newly created resource in storage. - */ - public function store(Request $request) - { - // - } - - /** - * Display the specified resource. - */ - public function show(Transaction $transaction) - { - // - } - - /** - * Show the form for editing the specified resource. - */ - public function edit(Transaction $transaction) - { - // - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, Transaction $transaction) - { - // - } - - /** - * Remove the specified resource from storage. - */ - public function destroy(Transaction $transaction) - { - // - } -} diff --git a/app/Http/Controllers/WritingController.php b/app/Http/Controllers/WritingController.php index 688f478..974852f 100644 --- a/app/Http/Controllers/WritingController.php +++ b/app/Http/Controllers/WritingController.php @@ -15,11 +15,8 @@ class WritingController extends Controller */ public function index() { - Log::info('w index'); - $writings = Writing::all(); - Log::info($writings); return view('writings.index', [ - 'writings' => Writing::orderBy('created_at')->paginate(20) + 'writings' => Writing::orderBy('created_at', 'desc')->paginate(20) ]); } @@ -79,7 +76,15 @@ class WritingController extends Controller */ public function update(Request $request, Writing $writing) { - + $validated = $request->validate([ + 'title' => 'required|min:3|max:255', + 'content' => 'required|min:10', + ]); + + $writing->update($validated); + + return redirect()->route('w.show', $writing) + ->with('success', 'Writing updated successfully!'); } /** @@ -87,6 +92,9 @@ class WritingController extends Controller */ public function destroy(Writing $writing) { - return 'todo'; + $writing->delete(); + + return redirect()->route('w.index') + ->with('success', 'Writing deleted.'); } } diff --git a/app/Http/Requests/StoreLinkRequest.php b/app/Http/Requests/StoreLinkRequest.php index ff58d72..250c98d 100644 --- a/app/Http/Requests/StoreLinkRequest.php +++ b/app/Http/Requests/StoreLinkRequest.php @@ -22,7 +22,9 @@ class StoreLinkRequest extends FormRequest public function rules(): array { return [ - // + 'label' => 'required|string|min:2|max:255', + 'url' => 'required|string|min:3|max:255', + 'description' => 'nullable|string|max:255', ]; } } diff --git a/app/Http/Requests/StoreQuoteRequest.php b/app/Http/Requests/StoreQuoteRequest.php index e9859fb..68f1158 100644 --- a/app/Http/Requests/StoreQuoteRequest.php +++ b/app/Http/Requests/StoreQuoteRequest.php @@ -11,7 +11,7 @@ class StoreQuoteRequest extends FormRequest */ public function authorize(): bool { - return false; + return true; } /** diff --git a/app/Http/Requests/UpdateLinkRequest.php b/app/Http/Requests/UpdateLinkRequest.php index da864b8..22ff43c 100644 --- a/app/Http/Requests/UpdateLinkRequest.php +++ b/app/Http/Requests/UpdateLinkRequest.php @@ -22,7 +22,9 @@ class UpdateLinkRequest extends FormRequest public function rules(): array { return [ - // + 'label' => 'sometimes|string|min:2|max:255', + 'url' => 'sometimes|string|min:3|max:255', + 'description' => 'nullable|string|max:255', ]; } } diff --git a/app/Http/Requests/UpdateQuoteRequest.php b/app/Http/Requests/UpdateQuoteRequest.php index 93804a8..9a2e50d 100644 --- a/app/Http/Requests/UpdateQuoteRequest.php +++ b/app/Http/Requests/UpdateQuoteRequest.php @@ -11,7 +11,7 @@ class UpdateQuoteRequest extends FormRequest */ public function authorize(): bool { - return false; + return true; } /** diff --git a/app/Models/Inventory.php b/app/Models/Inventory.php deleted file mode 100644 index be2bc0f..0000000 --- a/app/Models/Inventory.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace App\Models; - -use Illuminate\Database\Eloquent\Model; - -class Inventory extends Model -{ - // -} diff --git a/app/Models/Item.php b/app/Models/Item.php deleted file mode 100644 index 3b92220..0000000 --- a/app/Models/Item.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace App\Models; - -use Illuminate\Database\Eloquent\Model; - -class Item extends Model -{ - // -} diff --git a/app/Models/Link.php b/app/Models/Link.php index 6f3648c..619a3e3 100644 --- a/app/Models/Link.php +++ b/app/Models/Link.php @@ -3,12 +3,10 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -use App\Models\Traits\AutoFillable; class Link extends Model { - //use AutoFillable; - public $fillable = ['label', 'url', 'description', 'user_id']; + protected $fillable = ['label', 'url', 'description', 'user_id']; public function tags(){ return $this->belongsToMany(Tag::class); diff --git a/app/Models/Quote.php b/app/Models/Quote.php index f340ba9..3b93ddb 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -10,7 +10,7 @@ class Quote extends Model /** @use HasFactory<\Database\Factories\QuoteFactory> */ use HasFactory; - public $fillable = [ + protected $fillable = [ 'author', 'text', 'source', diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php deleted file mode 100644 index 32b210a..0000000 --- a/app/Models/Transaction.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace App\Models; - -use Illuminate\Database\Eloquent\Model; - -class Transaction extends Model -{ - // -} diff --git a/app/Models/User.php b/app/Models/User.php index e59d7fa..16c7143 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -68,11 +68,11 @@ class User extends Authenticatable } public function getStorageQuota(){ - $roles = $this->roles(); + $roles = $this->roles()->get(); $quota = 0; foreach ($roles as $r){ - if ($role->storage_quota > $quota){ - $quota = $role->storage_quota; + if ($r->storage_quota > $quota){ + $quota = $r->storage_quota; } } return $quota; diff --git a/database/migrations/2025_01_04_021047_inventory.php b/database/migrations/2025_01_04_021047_inventory.php deleted file mode 100644 index 88fa2f3..0000000 --- a/database/migrations/2025_01_04_021047_inventory.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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 - { - // - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/migrations/2025_01_04_021054_transaction.php b/database/migrations/2025_01_04_021054_transaction.php deleted file mode 100644 index 88fa2f3..0000000 --- a/database/migrations/2025_01_04_021054_transaction.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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 - { - // - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/migrations/2025_01_04_021120_item.php b/database/migrations/2025_01_04_021120_item.php deleted file mode 100644 index 88fa2f3..0000000 --- a/database/migrations/2025_01_04_021120_item.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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 - { - // - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/migrations/2026_03_06_171040_fix_links_table_description_nullable_and_fk.php b/database/migrations/2026_03_06_171040_fix_links_table_description_nullable_and_fk.php new file mode 100644 index 0000000..9787a5d --- /dev/null +++ b/database/migrations/2026_03_06_171040_fix_links_table_description_nullable_and_fk.php @@ -0,0 +1,50 @@ +<?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::table('links', function (Blueprint $table) { + // Make description nullable (was NOT NULL) + $table->string('description')->nullable()->change(); + + // Fix user_id column type to match users.id (bigint unsigned) + $table->unsignedBigInteger('user_id')->nullable()->change(); + }); + + // Add proper foreign key constraint if it doesn't exist + try { + Schema::table('links', function (Blueprint $table) { + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + }); + } catch (\Exception $e) { + // FK may already exist + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + try { + Schema::table('links', function (Blueprint $table) { + $table->dropForeign(['user_id']); + }); + } catch (\Exception $e) { + // FK may not exist + } + + Schema::table('links', function (Blueprint $table) { + $table->string('description')->nullable(false)->change(); + $table->integer('user_id')->change(); + }); + } +}; |
