定制 thanosalexander/activity 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thanosalexander/activity

Composer 安装命令:

composer require thanosalexander/activity

包简介

This package keeps activities for various actions

README 文档

README

Tracks activities fired when specific types happened.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Installation

To get the latest version of Activities simply require it in your composer.json file.

"thanosalexander/activity":"~1.0"

You'll then need to run composer install to download it and have the autoloader updated.

Once Activities is installed you need to register the service provider with the application. Open up config/app.php and find the providers key.

'providers' => array(
    ...
    ...
    \Thanosalexander\Activity\ActivityServiceProvider::class,

)

Activities also ships with two facades which provides the static syntax for creating activities. You can register the facade in the aliases key of your config/app.php file.

'aliases' => array(

    ...
    ..

    'Activity' => \Thanosalexander\Activity\Facades\Activity::class,
    'Type' => \Thanosalexander\Activity\Facades\Type::class

)

Publish the configurations

Run this on the command line from the root of your project:

$ php artisan vendor:publish

A configuration file will be publish to config/activities.php Also the migrations will be published into migrations folder!

Run the migrations

Activities package comes with two tables, activities_types and activities. Just go to terminal and run

$ php artisan migrate

Now the tables are created!

Usage

Create a new Type

$type= \Type::create([
            'name'=>'login',
            'description'=>'login action',
            'label'=>'Login'
        ]);

All the fields are required in order to create an activity type! Also the name is unique!

Create a new Activity

$activity = \Activity::create([
            'user_id'=>0,
            'type_id'=>3,
            'content'=>'The content of this action',
            'ip'=> \Illuminate\Support\Facades\Request::getClientIp()
        ]);

The user_id field is not required in order to create an Activity! However for guest users actions the field will be nullable

Controllers

The package comes with two controllers TypeController and ActivityController. They are almost resource controller with very simple syntax.

Activities Routes

 /**
     * Activities Routes
     */
    Route::get('activities',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\ActivityController@index',
        'as'=>'activities.index'
    ));
    Route::post('activities/create',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\ActivityController@store',
        'as'=>'activities.store'
    ));
    Route::put('activities/update/{id}',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\ActivityController@update',
        'as'=>'activities.update'
    ));
    Route::get('activities/show/{id}',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\ActivityController@show',
        'as'=>'activities.show'
    ));
    Route::delete('activities/delete/{id}',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\ActivityController@delete',
        'as'=>'activities.delete'
    ));

Types Routes

/**
     * Types Routes
     */
    Route::get('types',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\TypeController@index',
        'as'=>'types.index'
    ));
    Route::post('types/create',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\TypeController@store',
        'as'=>'types.store'
    ));
    Route::put('types/update/{id}',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\TypeController@update',
        'as'=>'types.update'
    ));
    Route::get('types/show/{id}',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\TypeController@show',
        'as'=>'types.show'
    ));
    Route::delete('types/delete/{id}',array(
        'uses'=>'thanosalexander\activity\Http\Controllers\TypeController@delete',
        'as'=>'types.delete'
    ));

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固