first commit
This commit is contained in:
commit
0baac018a2
1011 changed files with 145854 additions and 0 deletions
66
app/Models/Import.php
Normal file
66
app/Models/Import.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
/**
|
||||
* App\Models\Import
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Import newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Import newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Import query()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Import extends Model
|
||||
{
|
||||
public static $start;
|
||||
public static $max_time;
|
||||
|
||||
|
||||
|
||||
public static $rules = [
|
||||
'file' => 'required|mimes:xls,xlsx'
|
||||
];
|
||||
|
||||
public static $messages = [
|
||||
'file.mimes' => 'Datei ist kein Excel Format',
|
||||
'file.required' => 'Excel is required'
|
||||
];
|
||||
|
||||
protected static $row = [];
|
||||
|
||||
public static function setRow($row){
|
||||
|
||||
// self::checkTime();
|
||||
self::$row[] = $row;
|
||||
}
|
||||
|
||||
|
||||
public static function checkTime(){
|
||||
|
||||
if(round((microtime(true) - self::$start), 2) > 29){
|
||||
echo 'Total execution time in seconds: ' . round((microtime(true) - self::$start), 2);
|
||||
die();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function countRows(){
|
||||
return count(self::$row);
|
||||
}
|
||||
|
||||
|
||||
public static function break(){
|
||||
echo count(self::$row)."<br>";
|
||||
echo 'Total execution time in seconds: ' . round((microtime(true) - self::$start), 2);
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue