2017 © Pedro Peláez
 

library laravel-author

A simple way to generate the model's author user when created

image

binarycabin/laravel-author

A simple way to generate the model's author user when created

  • Thursday, December 7, 2017
  • by binarycabin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel-Author

A simple way to generate the model's author user when created, (*1)

composer require binarycabin/laravel-author

This package adds a very simple trait to automatically save the user id who created this model., (*2)

Simply add the "\BinaryCabin\LaravelAuthor\Traits\HasAuthorUser;" trait to your model:, (*3)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Project extends Model
{

    use \BinaryCabin\LaravelAuthor\Traits\HasAuthorUser;

}

If your column name is not "author_user_id", simply add a new property to your model named "authorUserIdFieldName":, (*4)

protected $authorUserIdFieldName = 'user_id';, (*5)

This trait also provides a relationship:, (*6)

dump($project->authorUser)

and query scope:, (*7)

dump(\App\Project::byAuthorUser($userId)->get());

The Versions

07/12 2017

dev-master

9999999-dev

A simple way to generate the model's author user when created

  Sources   Download

MIT

14/11 2017

1.0.0

1.0.0.0

A simple way to generate the model's author user when created

  Sources   Download

MIT