A basic Laravel project aimed at facilitating rapid prototyping.

Overview

HTG Laravel

A basic Laravel project aimed at facilitating rapid prototyping. Why write yet another login form when you just want to try something out?

This project has:

  • User Registration and Authentication
  • Admin area with user management.
  • Admin area using the excellent AdminLTE theme from Abdullah Almaseed (https://almsaeedstudio.com/)

Screenshot

Requirements

  • PHP 5.6+ (recommended PHP7+)
  • MySQL 5.6
  • Apache or Nginx web server
  • composer installed

Installation

  1. Clone the repository to a local folder
  2. Install the dependencies with composer: composer install
  3. Copy the .env.example file to .env. cp .env.example .env
  4. Set up a MySQL Schema and add the credentials to .env.
  5. Create a security key: php artisan key:generate
  6. Run the migrations to install the database tables: php artisan migrate
  7. Run the database seeds: php artisan db:seed
  8. Start the web server php artisan serve should be enough to get you up and running.
  9. Finally, browse to http://localhost:8000, and go make something awesome.

Module Structure

This application consists of a modular strucure. For example, if you wanted to implement a contact us form on your website you would add this to a separate module.

Create a new directory inside the modules directory, and create new directories inside that for Controllers, Models, and Views. Your directory structure should look like this:

app/
    ...
    Modules/
        Contact/
            Controllers/
            Models/
            Views/

Edit the config/module.php file and add the directory name of your module to the array:

<?php

return [
    'modules' => [
        'User',
        'Contact'
    ]
];

Great, your module is good to go.

Using Modules

You would use your modules as you would any other part of Laravel. Your module's Controller classes go in your module's Controller directory, models in the Models directory, and the views in the Views directory.

Module routing

Routes for your modules are added to a routes.php file in the root of your module's directory. A prefix and namespace are added to the Route::group() method allowing your routes to be separated away. For example, a route for the Contact module looks like this:

<?php
// app/Modules/Contact/routes.php

Route::group([
        'prefix' => 'contact',
        'namespace' => 'App\Modules\Contact\Controllers'
    ],
    function () {
        Route::get('/', ['as' => 'contact_index', 'uses' => 'IndexController@index']);
        Route::post('/', ['as' => 'contact_submit', 'uses' => 'IndexController@submit']);
});

You would use the route in your template as:

<a href="{{ URL::route('contact_index') }}" title="contact">Contact</a>

Module Views

To use your module's views from your controller classes you should reference them using the namespace you set up in the routes file:

<?php
namespace App\Modules\Contact\Controllers;

use App\Http\Controllers\Controller;

class IndexController extends Controller {

    public function index()
    {
        return View('contact::index');
    }

 }

Module modules

TBC

References

Module structure based on Kamran Ahmed's blog post at http://kamranahmed.info/blog/2015/12/03/creating-a-modular-application-in-laravel/

You might also like...
Opinionated way to start a new Laravel project.

Laravel Boilerplate The way I start new Laravel projects. Why? I just got tired of repeating the same things over and over. I made this repository pub

Modular Laravel - Boilerplate project starter

MODULAR About Modular Laravel This project is a personal blueprint starter with customized modular / SOA architecture. Kostadin Keljtanoski Install Yo

This project is for developing an blog_api using laravel

Blog Api A TDD implementation of a weblog RESTful API. This project is a REST api implementation of my other project laravel with more features. featu

A script to help setup Laravel project with common packages and configurations

About Snap Snap allow developer to create scaffold Laravel project. Installation Clone this repository in your user home directory. cd ~ git clone htt

Starterkits Project With Laravel + Inertia JS + Vue + Vuetify

Laravel InertiaJS Vuetify A laravel inertiajs vuetify starterkit Demo You can access demo app in : https://laravel-inertia-vuetify.herokuapp.com/ Feat

Larawiz is a easy project scaffolder for Laravel
Larawiz is a easy project scaffolder for Laravel

The Laravel 8 scaffolder you wanted but never got, until now!

Laravel-7 "Personal Area" Project

Laravel-7 "Personal Area" Project System Requirements Apache

This is a Starter Laravel 8 project with Vue 3 and Bootstrap 5 installed for you.

Laravel8-Vue3-Bootstrap5 This is a Starter Laravel 8 project with Vue 3 and Bootstrap 5. Instalation Guide: As always you need to: composer install Th

Quick Start - Project With Laravel 8.x and AdminLTE 3

Quick Start - Project With Laravel 8.x and AdminLTE 3 (feat. Docker) Cursos de Laravel - PT-BR Step by step Clone this Repository git clone https://gi

Comments
  • Registering throws an error

    Registering throws an error

    I tried to register and I was given an error;

    ErrorException in User.php line 80:
    
    Trying to get property of non-object (View: /Users/trovster/Sites/htg-laravel/resources/views/layouts/main.blade.php) (View: /Users/trovster/Sites/htg-laravel/resources/views/layouts/main.blade.php)
    

    going to the root path also shows the same error.

    I visited http://localhost:8000/auth/logout which then showed me the login/register options.

    opened by trovster 2
Owner
Andrew McCombe
Experienced web developer focussed on PHP/Back-end development.
Andrew McCombe
Laravel Framework 5 Bootstrap 3 Starter Site is a basic application with news, photo and video galeries.

Laravel Framework 5.1 Bootstrap 3 Starter Site Starter Site based on on Laravel 5.1 and Boostrap 3 Features Requirements How to install Application St

null 900 Dec 22, 2022
This package provides an artisan command to generate a basic crud with Restful API support

NHRROB Crud Generator Package This package provides an artisan command to generate a basic crud composer install command: composer require nhrrob/crud

Nazmul Hasan Robin 22 Jun 24, 2022
Basic calculator made in PHP, CSS3 and JavaScript.

Basic Calculator in PHP Basic calculator in PHP made for treining. ??‍?? Used Technology PHP HTML CSS JavaScript ?? License This project is under MIT

Maria Peixoto 3 Aug 24, 2021
Template for repository helper, library - Basic, Simple and Lightweight

Template start helper, library Template for repository helper, library - Basic, Simple and Lightweight Use this Template First, you can Use this templ

Hung Nguyen 2 Jun 17, 2022
Simple mobile shop using basic php

simple-mobile-shop simple mobile shop using basic php Project Overview Go to your Xammp/wamp-server root folder Then create a folder named "mobileshop

IQBAL HASAN 2 Aug 9, 2022
Basic admin panel with authentication and CURD operation..

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Raja kumar 2 Nov 21, 2022
Basic Crud operations using smarty and php

Smarty template engine Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Documentati

null 0 Aug 8, 2022
The Laravel Boilerplate Project - https://laravel-boilerplate.com

Laravel Boilerplate (Current: Laravel 8.*) (Demo) Demo Credentials Admin: [email protected] Password: secret User: [email protected] Password: secret Offici

Anthony Rappa 5.4k Jan 4, 2023
Base Laravel project with React and Laravel Sanctum authentication

About this project This is a base Laravel project with ReactJS frontend and Laravel Sanctum API authentication. You could read more about here. Instal

David Toth 8 Oct 25, 2022
Start a new Laravel 8 project with the AdminLTE template installed.

AdminLTE template Laravel 8 package Start a new Laravel 8 project with the AdminLTE template installed. Installation Create database. Clone repository

Mairo Rodrigues 12 Dec 21, 2022