Début de MyX
This commit is contained in:
30
app/Http/Controllers/FakeController.php
Normal file
30
app/Http/Controllers/FakeController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Fake;
|
||||
use Revolution\Google\Sheets\Facades\Sheets;
|
||||
|
||||
class FakeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$sheets = Sheets::spreadsheet('1sXZ6fdljhv3byCvX9w_eG9hxXzeg9wlGWcWGxl4-_Xc')->sheet('Public')->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$organizers = $posts->toArray();
|
||||
|
||||
foreach ($organizers as $organizer){
|
||||
$screen_name = $organizer['@'];
|
||||
$screen_name = str_replace('@', '', $screen_name);
|
||||
|
||||
$exist = Fake::where('screen_name', $screen_name)->first();
|
||||
|
||||
if(!$exist){
|
||||
Fake::create([
|
||||
'screen_name' => $screen_name
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
app/Models/Account.php
Normal file
18
app/Models/Account.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Account extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $casts = [
|
||||
'password' => 'encrypted',
|
||||
'cookies' => 'encrypted',
|
||||
];
|
||||
|
||||
protected $guarded = ['id'];
|
||||
}
|
||||
18
app/Models/Category.php
Normal file
18
app/Models/Category.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function contests()
|
||||
{
|
||||
return $this->hasMany(Contest::class);
|
||||
}
|
||||
}
|
||||
22
app/Models/Contest.php
Normal file
22
app/Models/Contest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contest extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function organizer()
|
||||
{
|
||||
return $this->belongsTo(Organizer::class);
|
||||
}
|
||||
}
|
||||
14
app/Models/Fake.php
Normal file
14
app/Models/Fake.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Fake extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
}
|
||||
18
app/Models/Organizer.php
Normal file
18
app/Models/Organizer.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Organizer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function contests()
|
||||
{
|
||||
return $this->hasMany(Contest::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user