Recherche des tweets de réponse avec l'API Tweeter
This commit is contained in:
51
app/Nova/Actions/AutoLogin.php
Normal file
51
app/Nova/Actions/AutoLogin.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Actions;
|
||||
|
||||
use foroco\BrowserDetection;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Lexicon\ActionButtonSelector\ActionAsButton;
|
||||
|
||||
class AutoLogin extends Action
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
use ActionAsButton;
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
$Browser = new BrowserDetection();
|
||||
$useragent = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
if (str_contains($Browser->getOS($useragent)['os_family'], 'android')) {
|
||||
// Générer un lien spécifique pour Kiwi
|
||||
$kiwiLink = 'intent://x.com?auth_token='.$models->first()->auth_token.'#Intent;package=com.kiwibrowser.browser;scheme=https;end';
|
||||
return Action::redirect($kiwiLink);
|
||||
}
|
||||
|
||||
return Action::openInNewTab('https://x.com?auth_token='.$models->first()->auth_token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
54
app/Nova/Actions/Connexion.php
Normal file
54
app/Nova/Actions/Connexion.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Actions;
|
||||
|
||||
use App\Http\Controllers\AccountController;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Lexicon\ActionButtonSelector\ActionAsButton;
|
||||
use App\Http\Controllers\TwitterController;
|
||||
|
||||
class Connexion extends Action
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
use ActionAsButton;
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
//return Action::openInNewTab('/login/'.$models->first()->id);
|
||||
|
||||
$connexion = (new AccountController)->login($models->first()->id);
|
||||
|
||||
if($connexion){
|
||||
return Action::message('Compte synchronisé');
|
||||
}elseif(!$connexion){
|
||||
return Action::message('Erreur de connexion');
|
||||
}else{
|
||||
return $connexion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
57
app/Nova/Actions/Participer.php
Normal file
57
app/Nova/Actions/Participer.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Actions;
|
||||
|
||||
use App\Models\Contest;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Lexicon\ActionButtonSelector\ActionAsButton;
|
||||
use App\Http\Controllers\TwitterController;
|
||||
|
||||
class Participer extends Action
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
use ActionAsButton;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->withoutConfirmation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
if($models->first()->participated == 1){
|
||||
Action::danger('Vous avez déjà participé');
|
||||
}
|
||||
else{
|
||||
$contest = Contest::find($models->first()->id);
|
||||
$contest->participated = 1;
|
||||
$contest->save();
|
||||
Action::message('Participation en cours');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
44
app/Nova/Actions/Webmail.php
Normal file
44
app/Nova/Actions/Webmail.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Actions;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Lexicon\ActionButtonSelector\ActionAsButton;
|
||||
|
||||
class Webmail extends Action
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
use ActionAsButton;
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
$mail = urlencode($models->first()->rambler_email);
|
||||
$password = urlencode($models->first()->rambler_password);
|
||||
|
||||
return Action::openInNewTab('https://mail.myx.ovh/?postlogin&Email='.$mail.'&Password='.$password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user