{"id":26871288,"url":"https://github.com/codeadamca/laravel-blade-cms-journal","last_synced_at":"2026-05-09T14:38:07.095Z","repository":{"id":274370613,"uuid":"618090785","full_name":"codeadamca/laravel-blade-cms-journal","owner":"codeadamca","description":"A basic journal module for a Laravel CMS. ","archived":false,"fork":false,"pushed_at":"2025-01-26T21:32:44.000Z","size":2962,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T22:25:24.345Z","etag":null,"topics":["blade","cms","laravel","php"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeadamca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-23T18:24:45.000Z","updated_at":"2025-01-26T21:32:48.000Z","dependencies_parsed_at":"2025-01-26T22:35:28.106Z","dependency_job_id":null,"html_url":"https://github.com/codeadamca/laravel-blade-cms-journal","commit_stats":null,"previous_names":["codeadamca/laravel-blade-cms-journal"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeadamca%2Flaravel-blade-cms-journal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeadamca%2Flaravel-blade-cms-journal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeadamca%2Flaravel-blade-cms-journal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeadamca%2Flaravel-blade-cms-journal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeadamca","download_url":"https://codeload.github.com/codeadamca/laravel-blade-cms-journal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246429486,"owners_count":20775809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blade","cms","laravel","php"],"created_at":"2025-03-31T07:19:00.836Z","updated_at":"2026-05-09T14:38:02.064Z","avatar_url":"https://github.com/codeadamca.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Journal Module for Laravel CMS\n\nThis is a basic journal module developed to work with the Laravel CMS avalable in my [laravel-blade-cms](https://github.com/codeadamca/laravel-blade-cms) repo.\n\n## Database\n\nBefore we start coding the list, add, edit, and delete files, we need a table to store our journal entries. Creating a table with testing data requires us to create a migration, model, factory, and add some instructions to our seeding script. \n\n### Migrations\n\nBefore we make any files, use the Terminal to change the working directory to your project directory. I am using a Mac and my project folder was on my desktop:\n\n``` sh\ncd ~\ncd Desktop\ncd laravel-blade-cms\n```\n\n1. Using the Laravel Artisan tool, create a new migration file:\n\n    ```sh\n    php artisan make:migration create_entries_table\n    ```\n    \n    You will now have a new migration file named `\u003cYEAR\u003e_\u003cMONTH\u003e_\u003cDAY\u003e_\u003cSECONDS\u003e_create_entries_table.php`.\n    \n\u003e [!Note]   \n\u003e Laravel uses a database naming convention named [Eloquent](https://laravel.com/docs/10.x/eloquent). Eloquent states that tables names are lowercase and plural.  \n\n2. In the new migration file, change the schema to:\n\n    ```php\n    Schema::create('entries', function (Blueprint $table) {\n        $table-\u003eid();\n\n        $table-\u003estring('title');\n        $table-\u003etext('content');\n\n        $table-\u003etimestamp('learned_at');\n\n        $table-\u003etimestamps();\n    });\n    ```\n    \n### Model\n\nWe need a new model to define the `entries` table relationships and rules. The model scaffolding that Artisan provides is sufficient.\n\n1. Create a new `Entry` model: \n\n    ```sh\n    php artisan make:model Entry\n    ```\n    \n2. You will now have a filed named `Entry.php` in the `/app/Models` folder. No changes needed.\n    \n### Factory\n\nWe need a factory to give Laravel instructions on how to populate the factory table. \n\n1. Creat a new factory:\n\n    ```sh\n    php artisan make:factory EntryFactory\n    ```\n    \n2. You will now have a filed named `EntryFactory.php` in the `/database/factories` folder. Open this faile and change the definiation method retrn value to:\n\n    ```php\n    return [\n        'title' =\u003e $this-\u003efaker-\u003esentence,\n        'content' =\u003e $this-\u003efaker-\u003eparagraph,\n        'learned_at' =\u003e $this-\u003efaker-\u003edateTimeThisMonth,\n    ];\n    ```\n    \n### Seeding\n\nLastly we need to give Laravel instructions on how many entries to add. \n\n1. Open up the `DatabaseSeeder.php` file in the `/database/seeders` folder.\n\n2. At the top of the file add the entries model, add this line below `use App\\ModelProject;`:\n\n    ```php\n    use App\\Models\\Entry;\n    ```\n    \n3. Add some code to remove existing records when seeding it initiated. Add this below `Project::truncate();`:\n\n    ```php\n    Entry::truncate();\n    ```\n    \n4. Add code to add four fake entries. Add this line under `Project::factory()-\u003ecount(4)-\u003ecreate();`:\n\n    ```php\n    Entry::factory()-\u003ecount(4)-\u003ecreate();\n    ```\n    \n### Execute\n    \nLastly we need to execute our migrations and seeding. Using the Terminal (or GitBash on a Windows machine) run this comment:\n\n```sh\nphp artisan migrate:fresh --seed\n```\n\n![Migrate and Seed](_readme/screenshot-migrate-seed.png)\n\nIf you received no errors, there will be tables with data in your database. OPen up phpMyAdmin to check!\n\n![Entries Table](_readme/screenshot-entries.png)\n\n## List\n\nNow that the database is ready and poulated, we need to create the list, add, edit, and delete code. Let's start by adding the list.\n\n### Dashboard\n\nOpen up `dashboard.blade.php` in the `resources/views/console/` folder, and add link to manage entries. Add this line after types.\n\n```php\n\u003cli\u003e\u003ca href=\"/console/entries/list\"\u003eManage Journal Entries\u003c/a\u003e\u003c/li\u003e\n```\n\nOpen a browser, login to the CMS, and click `Manage Journal Entries`. You should get a `page not found` error. We need to add some new routes.\n\n![Page Not Found](_readme/screenshot-404.png)\n\n### Routes\n\nOpen the `web.php` file in the routes folder. Import the `EntriesController` by adding a `use` command to the top of your file.\n\n```php\nuse App\\Http\\Controllers\\EntriesController;\n```\n\nCopy and paste one of the list routes from one of the other modules and update for `entries`.\n\n```php\nRoute::get('/console/entries/list', [EntriesController::class, 'list'])-\u003emiddleware('auth');\n```\n\nRefresh your browser, and you will get a new error message that states `Controller EntriesController does not exist`.\n\n![Controller Doees Not Exist](_readme/screenshot-controller.png)\n\n### Controller and MEthod\n\nUse the Laravel Artisan tool to make a new controller.\n\n```sh\nphp artisan make:controller EntriesController\n```\n\nRefresh the browser and you will get a new error that states `Method EntriesController::list does not exist`.\n\n![Method Does Not Exist](_readme/screenshot-method.png)\n\nOpen up the new `EntriesCopntroller.php` file. Add a `use` comment too import the Entry model.\n\n```php\nuse App\\Models\\Entry;\n```\n\nAdd a list method. This can be copied from one of the other modules and then adjusted for entries.\n\n```php\npublic function list()\n{\n    return view('entries.list', [\n        'entries' =\u003e Entry::all()\n    ]);\n}\n```\n\nRefresh the browser and you will get a new error that states `View [entries.list] not found.`.\n\n![View Doees Not Exist](_readme/screenshot-view.png)\n   \n### Views\n\nLastly we need to create a view. In the `resources/views/` folder, create a new folder named `entries` and copy the `list.blade.php` file from one of the other modules, and adjust for entries.\n\n```php\n@extends ('layout.console')\n\n@section ('content')\n\n\u003csection class=\"w3-padding\"\u003e\n\n    \u003ch2\u003eManage Journal Entries\u003c/h2\u003e\n\n    \u003ctable class=\"w3-table w3-stripped w3-bordered w3-margin-bottom\"\u003e\n        \u003ctr class=\"w3-red\"\u003e\n            \u003cth\u003eTitle\u003c/th\u003e\n            \u003cth\u003eDate\u003c/th\u003e\n            \u003cth\u003e\u003c/th\u003e\n            \u003cth\u003e\u003c/th\u003e\n        \u003c/tr\u003e\n        @foreach ($entries as $entry)\n            \u003ctr\u003e\n                \u003ctd\u003e{{$entry-\u003etitle}}\u003c/td\u003e\n                \u003ctd\u003e$entry-\u003elearned_at}}\u003c/td\u003e\n                \u003ctd\u003e\u003ca href=\"/console/entries/edit/{{$entry-\u003eid}}\"\u003eEdit\u003c/a\u003e\u003c/td\u003e\n                \u003ctd\u003e\u003ca href=\"/console/entries/delete/{{$entry-\u003eid}}\"\u003eDelete\u003c/a\u003e\u003c/td\u003e\n            \u003c/tr\u003e\n        @endforeach\n    \u003c/table\u003e\n\n    \u003ca href=\"/console/entries/add\" class=\"w3-button w3-green\"\u003eNew Journal Entry\u003c/a\u003e\n\n\u003c/section\u003e\n\n@endsection\n```\n\nFinal we can use the Carbon class to format the date. Switch the line that outputs the date.\n\n```php\n\u003ctd\u003e{{$entry-\u003elearned_at}}\u003c/td\u003e\n```\n\nWith this.\n\n```php\n\u003ctd\u003e{{\\Carbon\\Carbon::parse($entry-\u003elearned_at)-\u003eformat('d/m/Y h:i A')}}\u003c/td\u003e\n```\n\nRefresh your browser.\n\n![Completed](_readme/screenshot-complete.png)\n\n## Add, Edit and Delete\n\nUsing the projects module as a guide, create the add, edit, and delete pages for the entries module.\n   \n***\n\n## Repo Resources\n\n* [laravel-blade-cms](https://github.com/codeadamca/laravel-blade-cms)\n* [Laravel](https://laravel.com/)\n\n\u003cbr\u003e\n\u003ca href=\"https://codeadam.ca\"\u003e\n\u003cimg src=\"https://cdn.codeadam.ca/images@1.0.0/codeadam-logo-coloured-horizontal.png\" width=\"200\"\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeadamca%2Flaravel-blade-cms-journal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeadamca%2Flaravel-blade-cms-journal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeadamca%2Flaravel-blade-cms-journal/lists"}