This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Seth
Seth

For my next project I'm trying to get away from using wordpress. I love laravel and OctoberCMS seems to be the most mature CMS for it, so I'd really like to use it.

However there's an obstacle. I need to be able to understand how to easily add functionality that I would be able to add in wordpress.

For this project I need to add a simple form, which does the following:

  • Get's info from the user
  • Stores it in a database
  • Admin can view responses in a list
  • Can edit
  • Can delete, etc. (So a crud in the backend basically)

So far I've had trouble finding exactly what I need. There was a contact form plugin someone created, but that turned out to only email the contents of the form to a user.

I'm a decent coder, a lot of experience with mvc, and some beginner / intermediate experience with laravel. Can anyone link me to a tutorial or series of help files that will give me an example / help me build this out without error?

I really want to use this platform, but I've got to be able to nail the functionality.

Thank you so much! Seth

Seth
Seth

I'm going to document my process for trying to find a solution here.. (See? I'm trying!)

Came across this video in Resources:

Mastering Components https://vimeo.com/104896353

Which is great, BUT it doesn't have any backend. It's all frontend based. So the admin can not view / edit / this data, which will be critical for this application.. Continuing to search..

Seth
Seth

Huge breakthrough! :)

This plugin shows the backend functionality I'm looking for: https://github.com/daftspunk/oc-test-plugin

Full crud interfaces! Yay! Hope this helps someone.. I spent hours last night trying to dig this up. A reminder: Sometimes it's good to start fresh the next day.

Note: I had to log out and log back in to see it in the backend.

glindeman2315424
glindeman2315424

Thanks Seth,

I am also looking to do the same thing so I am going to use these resources you provided and hope it solves my problem.

Seth
Seth

Glindeman, great! Let me know if you have any questions.

October CMS is absolutely perfect for this functionality. The steps here are:

  1. Create the project you want to hold all your functionality on.

    php artisan create:plugin Glindeman.KillerApp

  2. Create the page in the CMS that you want to have your form on for the user to enter their info. (E.g /contact)

  3. Create a component that you will embed into that page (in this case "Contact")

    php artisan create:component Glindeman.KillerApp Contact

  4. Create a model for storing the data from that component

    php artisan create:model Glindeman.KillerApp Contact

  5. Create a controller for viewing the data using the backend

    php artisan create:controller Glindeman.KillerApp Contacts

  6. Register your component in the registerComponents section of plugins/glindeman/killerapp/Plugin.php

        'Glindeman\KillerApp\Components\Contact' => 'contact'
  7. Register your controller in the registerNavigation there too. (This looks like a lot, but you can just copy one of the other navigation items and it's easy to customize)

            'contacts' => [
            'label'       => 'Contacts',
            'url'         => Backend::url('glindeman/killerapp/contacts'),
            'icon'        => 'icon-leaf',
            'permissions' => ['glindeman.killerapp.*','viewer'],
            'order'       => 5,
        ],
  8. Alter version.yml to include the name of your migration file in the updates folder:

    1.0.1: First version of killerapp 1.0.2:

    • Create contact table - this is basically a comment, anything can go here
    • create_contacts_table.php
  9. Run October:Up to migrate your changes.

    php artisan october:up

This isn't my exact process, there's probably more that need to be done. If you run into issues editing stuff in the backend, make sure your permissions are right:

sudo chown www-data:www-data -R . 

Sometimes a class can't be found, and I have to refresh the autoload on composer

 composer dumpautoload

Okay, hope this helps! This basically the guide I wish existed going into this project.

Let me know if you encounter any issues, I think this framework is wonderful, just would like to see some more walkthroughs on commonly needed tasks like this!

Last updated

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.