sqits / laravel-userstamps Goto Github PK
View Code? Open in Web Editor NEWPackage to maintain the users who created, updated and deleted eloquent models
License: MIT License
Package to maintain the users who created, updated and deleted eloquent models
License: MIT License
Wasn't able to update to Laravel 8, what seems to be the problem?
Problem 1
- Installation request for sqits/laravel-userstamps ^0.0.7 -> satisfiable by sqits/laravel-userstamps[0.0.7].
- Can only install one of: laravel/framework[8.x-dev, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.0.0, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.0.1, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.0.2, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.0.3, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.0.4, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.1.0, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.2.0, 5.7.x-dev].
- Can only install one of: laravel/framework[v8.3.0, 5.7.x-dev].
- Conclusion: install laravel/framework 5.7.x-dev
- Installation request for laravel/framework ^8.0 -> satisfiable by laravel/framework[8.x-dev, v8.0.0, v8.0.1, v8.0.2, v8.0.3, v8.0.4, v8.1.0, v8.2.0, v8.3.0].
Hi, do you plan to support Laravel 10?
Please support ulid in users_table_column_type
// \config\userstamps.php
/*
* Define the table column type which is used in the table schema for
* the id of the user
*
* Options: increments, bigIncrements, uuid
* Default: bigIncrements
*/
"users_table_column_type" => "bigIncrements",
Can you add support for Laravel 8? I think you just need to change the composer.json
<?php
return [
/*
* Define the table which is used in de database to retrieve the users
*/
'users_table' => 'users',
/*
* Define the mmodel which is used for the relationships on your models
*/
'users_model' => App\HR\Auth\Users\User::class,
/*
* Define the column which is used in de database to save the user's id
* which created the model.
*/
'created_by_column' => 'created_by',
/*
* Define the column which is used in de database to save the user's id
* which updated the model.
*/
'updated_by_column' => 'updated_by',
/*
* Define the column which is used in de database to save the user's id
* which deleted the model.
*/
'deleted_by_column' => 'deleted_by',
];
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableActionPlans extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create( 'action_plans', function ( Blueprint $table ) {
$table->increments( 'id_action_plan' );
$table->string( 'name', 160 );
$table->string( 'description', 220 );
$table->integer( 'archived' );
$table->integer( 'history' );
$table->integer( 'status' );
$table->timestamps();
$table->softDeletes();
$table->userstamps();
$table->softUserstamps();
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists( 'action_plans' );
}
}
<?php
namespace App\HR\Metrics\ActionPlans;
use Illuminate\Database\Eloquent\Model;
use Sqits\UserStamps\Concerns\HasUserStamps;
/**
* @property varchar $name name
* @property varchar $description description
* @property timestamp $created_at created at
* @property timestamp $updated_at updated at
* @property timestamp $deleted_at deleted at
* @property \Illuminate\Database\Eloquent\Collection $shasambassador belongsToMany
* @property \Illuminate\Database\Eloquent\Collection $shastask belongsToMany
* @property \Illuminate\Database\Eloquent\Collection $dimensionshass belongsToMany
* @property \Illuminate\Database\Eloquent\Collection $employeeshastask belongsToMany
* @property \Illuminate\Database\Eloquent\Collection $measurehass belongsToMany
*/
class ActionPlan extends Model
{
use HasUserStamps;
/**
* Database table name
*/
protected $table = 'action_plans';
protected $primaryKey = 'id_action_plan';
/**
* Mass assignable columns
*/
protected $fillable
= [
'name',
'archived',
'history',
'description',
'status',
];
/**
* Date time columns.
*/
protected $dates = [];
}
public function store( StorePlanRequest $request)
{
$modelActionPlan = new ActionPlan();
$modelActionPlan->fill($request->all());
$modelActionPlan->save();
} /**
save the register but not register the user :/ i check with debug a break-point the method and never stop the break-point :S
NOTE: created good the table with field and relations but dont register user
Can you add support for Laravel 9? I think you just need to change the composer.json
I have a job to sent email to all users, after process sent email done, i update the data, but why column updated_by be null?
// app/Jobs/ProcessSendEmail.php
class ProcessSendEmail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(protected Payroll $payroll)
{
//
}
/**
* Execute the job.
*/
public function handle(): void
{
try {
Mail::to($payroll->email)->send(new PayrollEmail($payroll, true));
Payroll::find($this->payroll->id)->update([
'sent_at' => Carbon::now(),
]);
} catch (\Exception $e) {
}
}
}
Although this repo has a commit to support Laravel 9, the version on Packagist still only supports up to v8.
if use uuid type for id, macros has error in registerUserstamps
SQLSTATE[42830]: Invalid foreign key: 7 ERROR: there is no unique constraint matching given keys for referenced table "users" (SQL: alter table "users" add constraint "users_created_by_foreign" foreign key ("created_by") references "users" ("id") on delete set null)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
+9 vendor frames
10 database/migrations/2014_10_12_000000_create_users_table.php:30
Illuminate\Support\Facades\Facade::__callStatic("create")
+35 vendor frames
46 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.