samedi 12 octobre 2019

Displaying statistics of unique users and the total number of users in Laravel

I am very new Laravel programmer. I have in my project Laravel 5.8.

I have this code:

  1. Migration:

    Schema::create('statistics', function (Blueprint $table) {
       $table->bigIncrements('id');
       $table->bigInteger('company_id')->unsigned();
       $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
       $table->text('agent')->nullable();
       $table->dateTime('date')->nullable();
       $table->ipAddress('ip');
       $table->bigInteger('user_id')->default(0);
       $table->string('browser', 70)->nullable();
       $table->string('platform', 70)->nullable();
       $table->string('language', 12)->nullable();
       $table->string('url_address', 160)->nullable();
       $table->engine = "InnoDB";
       $table->charset = 'utf8mb4';
       $table->collation = 'utf8mb4_unicode_ci';
    });
    
  2. Model:

    class Statistics extends Model
    {
        protected $quarded = ['id'];
        protected $fillable = ['company_id', 'agent', 'date', 'ip', 'user_id', 'browser', 'platform', 'language', 'url_address'];
        public $timestamps = false;
    }  
    

In html form I have 2 input:

1. Show statistics from ...... (date input)
2. Show statistics to ..... (date input)

I want show statistics for url_address ='demo-user'.

I need to display information about unique users and total users in a selected period of time.

How can this be done?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire