Git Product home page Git Product logo

helpers-for-laravel-projects's Introduction

laravel-helper

A set of code snippets and functions to use across all projects.

This package contains some modifications made over a fresh installation of Laravel >= 5.3.

With time, this package would contain all modifications of the bare Laravel app. In other words, as soon as you include this package in your composer.json, you will get fully working starter kit.

Current version: Latest Stable Version

Features

Installation

  1. Add "unrulynatives/helpers": "^1.0" to your composer.json file.

  2. Add this to your config/app.php file in packages section Unrulynatives\Helpers\HelpersServiceProvider::class,

  3. Publish views, css & jQuery files to your app:

php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --force

Should you wish to publish to app folder only selected resources, use these commands:

  • public assets (js, css) php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --tag=publicassets --force

  • app files: Controllers, route files, Models php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --tag=app --force

  • app files: View files php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --tag=views --force

WARNING:

  • app files: View files to be copied to resources/views/layouts/ folder php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --tag=viewslayouts --force

  • migration files php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --tag=migrations --force

  • seed files php artisan vendor:publish --provider="Unrulynatives\Helpers\HelpersServiceProvider" --tag=seeds --force

  1. Register the package in your User model and wherever you see it is necessary - see features section.

In your User model: `use Unrulynatives\Helpers\UserExtensions;

class User extends Authenticatable {

use UserExtensions;`

  1. Register trait in other models In your model file declare: `use Unrulynatives\Helpers\ModelExtensions;

class [your-model-name-goes-here] extends Authenticatable {

use ModelExtensions;`

  1. You need to register the routes defined in this package. Open \app\Providers\RouteServiceProvider.php and
  • add $this->mapUnstarterRoutes(); to the map() function and
  • add the below code at the bottom of mapWebRoutes() fucntion:
    protected function mapUnstarterRoutes()
    {
        Route::group([
            'middleware' => 'web',
            'namespace' => $this->namespace,
        ], function ($router) {
            require base_path('unstarter/routes/unstarter.php');
        });
    }

Done!

Now you can check if the package works. Point your browser to unrulyhelpers. You should see a clock - an example developed along Laraveldaily tutorial http://laraveldaily.com/how-to-create-a-laravel-5-package-in-10-easy-steps/

To do (Future features)

Example usage

  1. To get Gravatar assigned to authenticated user's e-mail use <img src="{{Auth::user()->gravatar}}">

helpers-for-laravel-projects's People

Contributors

unrulynatives avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.