+ Homparty Part 1

This commit is contained in:
Kevin Adametz 2020-10-16 16:18:00 +02:00
parent 74923859d1
commit 9252094a04
43 changed files with 2385 additions and 66 deletions

View file

@ -0,0 +1,269 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\Homeparty;
use App\Models\HomepartyUser;
use App\Models\Product;
use App\Models\ShippingCountry;
use App\Models\ShoppingInstance;
use App\Models\ShoppingOrder;
use App\Models\ShoppingUser;
use App\Models\UserHistory;
use App\Models\UserShop;
use App\Services\Payment;
use App\Services\Util;
use App\User;
use Auth;
use Request;
use Validator;
use Yard;
class HomepartyController extends Controller
{
public function __construct()
{
$this->middleware('superadmin');
$this->middleware('active.account');
}
public function index()
{
$data = [
'homepartys' => Homeparty::where('auth_user_id', '=', \Auth::user()->id)->get(),
];
return view('user.homeparty.index', $data);
}
public function detail($id)
{
if($id === 'new'){
$homeparty = new Homeparty();
}else{
$homeparty = $this->getHomparty($id);
}
if($homeparty->homeparty_host){
$homeparty_user = $homeparty->homeparty_host;
}else{
$homeparty_user = new HomepartyUser();
$homeparty_user->is_host = true;
}
$data = [
'homeparty' => $homeparty,
'homeparty_user' => $homeparty_user,
];
return view('user.homeparty.detail', $data);
}
public function store($id = null)
{
$data = Request::all();
if($data['action'] === 'homeparty-party-store'){
$rules = array(
'date' => 'required',
'name' => 'required',
'place' => 'required'
);
}
if($data['action'] === 'homeparty-user-store'){
$rules = array(
'billing_salutation' => 'required',
'billing_firstname' => 'required',
'billing_lastname' => 'required',
'billing_address' => 'required',
'billing_zipcode' => 'required',
'billing_city' => 'required',
'billing_country_id' => 'required',
);
if (!Request::get('same_as_billing')) {
$rules = array_merge($rules, [
'shipping_firstname' => 'required',
'shipping_lastname' => 'required',
'shipping_address' => 'required',
'shipping_zipcode' => 'required',
'shipping_city' => 'required',
'shipping_salutation' => 'required',
'shipping_country_id' => 'required'
]);
}
}
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
if($data['action'] === 'homeparty-party-store'){
if(!$id){
//first save create and empty user/host
$homeparty = Homeparty::create($data);
do {
$token = Util::uuidToken();
} while( HomepartyUser::where('token', $token)->count() );
$homeparty_user = HomepartyUser::create([
'homeparty_id' => $homeparty->id,
'auth_user_id' => \Auth::user()->id,
'is_host' => true,
'token' => $token,
]);
}else {
$homeparty = $this->getHomparty($id);
$homeparty->fill($data)->save();
}
}
if($data['action'] === 'homeparty-user-store'){
$homeparty = $this->getHomparty($id);
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
$data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
$homeparty_user = $homeparty->homeparty_host;
$homeparty_user->fill($data)->save();
}
\Session()->flash('alert-save', '1');
return redirect(route('user_homeparty_detail', $homeparty->id));
}
public function guests($id = null)
{
$homeparty = $this->getHomparty($id);
$data = [
'homeparty' => $homeparty,
];
return view('user.homeparty.guests', $data);
}
public function guestDetail($id = null, $gid = null)
{
$homeparty = $this->getHomparty($id);
if($gid === 'new'){
do {
$token = Util::uuidToken();
} while( HomepartyUser::where('token', $token)->count() );
$homeparty_user = HomepartyUser::create([
'homeparty_id' => $homeparty->id,
'auth_user_id' => \Auth::user()->id,
'is_host' => false,
'token' => $token,
]);
}else{
$homeparty_user = HomepartyUser::findOrFail($gid);
if($homeparty->id !== $homeparty_user->homeparty_id){
abort(404);
}
}
$data = [
'homeparty' => $homeparty,
'homeparty_user' => $homeparty_user,
];
return view('user.homeparty.guest_detail', $data);
}
public function guestStore($id = null, $gid = null)
{
$data = Request::all();
$rules = array(
'billing_salutation' => 'required',
'billing_firstname' => 'required',
'billing_lastname' => 'required',
'billing_address' => 'required',
'billing_zipcode' => 'required',
'billing_city' => 'required',
'billing_country_id' => 'required',
);
if (!Request::get('same_as_billing')) {
$rules = array_merge($rules, [
'shipping_firstname' => 'required',
'shipping_lastname' => 'required',
'shipping_address' => 'required',
'shipping_zipcode' => 'required',
'shipping_city' => 'required',
'shipping_salutation' => 'required',
'shipping_country_id' => 'required'
]);
}
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
$homeparty = $this->getHomparty($id);
$homeparty_user = HomepartyUser::findOrFail($gid);
if($homeparty->id !== $homeparty_user->homeparty_id){
abort(404);
}
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
$data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
$homeparty_user->fill($data)->save();
\Session()->flash('alert-save', '1');
return redirect(route('user_homeparty_guests', [$homeparty->id]));
}
public function order($id = null)
{
$homeparty = $this->getHomparty($id);
abort(404);
/*$shopping_order = ShoppingOrder::findOrFail($id);
if($shopping_order->auth_user_id !== $user->id){
abort(404);
}
$shopping_order->getLastShoppingPayment();
$data = [
'shopping_order' => $shopping_order,
'isAdmin' => false,
];
return view('user.order.detail', $data);*/
}
public function delete($do, $id = null, $gid=null)
{
$homeparty = $this->getHomparty($id);
if($do === 'hpu'){
$homeparty_user = HomepartyUser::findOrFail($gid);
if($homeparty->id !== $homeparty_user->homeparty_id){
abort(404);
}
$homeparty_user->token = null;
$homeparty_user->save();
$homeparty_user->delete();
\Session()->flash('alert-success', "Homeparty Gast gelöscht");
return redirect(route('user_homeparty_guests', [$homeparty->id]));
}
if($do === 'hp') {
foreach ($homeparty->homeparty_users as $homeparty_user){
if ($homeparty->id !== $homeparty_user->homeparty_id) {
abort(404);
}
$homeparty_user->token = null;
$homeparty_user->save();
$homeparty_user->delete();
}
$homeparty->delete();
\Session()->flash('alert-success', "Homeparty gelöscht");
return redirect(route('user_homepartys'));
}
abort(404);
}
private function getHomparty($id){
$homeparty = Homeparty::findOrFail($id);
if($homeparty->auth_user_id !== \Auth::user()->id){
abort(404);
}
return $homeparty;
}
}

View file

@ -0,0 +1,96 @@
<?php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Mail\MailContact;
use App\Mail\MailVerifyAccount;
use App\Models\Homeparty;
use App\Models\HomepartyUser;
use App\Repositories\UserRepository;
use App\Services\UserService;
use App\User;
use GuzzleHttp\Client;
use Request;
use Illuminate\Support\Facades\Mail;
use App\Services\Util;
use Validator;
class HomepartyController extends Controller
{
public function __construct()
{
}
public function detail($token = null)
{
if(!$token){
abort(404);
}
$homeparty_user = HomepartyUser::where('token', $token)->where('token_active', true)->first();
if(!$homeparty_user){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
$data = [
'homeparty' => $homeparty_user->homeparty,
'homeparty_user' => $homeparty_user,
];
return view('user.homeparty.self_guest_detail', $data);
}
public function detailStore($token = null)
{
if(!$token){
abort(404);
}
$homeparty_user = HomepartyUser::where('token', $token)->where('token_active', true)->first();
if(!$homeparty_user){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
$rules = array(
'billing_salutation' => 'required',
'billing_firstname' => 'required',
'billing_lastname' => 'required',
'billing_address' => 'required',
'billing_zipcode' => 'required',
'billing_city' => 'required',
'billing_country_id' => 'required',
);
if (!Request::get('same_as_billing')) {
$rules = array_merge($rules, [
'shipping_firstname' => 'required',
'shipping_lastname' => 'required',
'shipping_address' => 'required',
'shipping_zipcode' => 'required',
'shipping_city' => 'required',
'shipping_salutation' => 'required',
'shipping_country_id' => 'required'
]);
}
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
$data = Request::all();
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
$data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
$homeparty_user->fill($data)->save();
\Session()->flash('alert-save', '1');
return redirect(route('homeparty', [$token]));
}
}

120
app/Models/Homeparty.php Normal file
View file

@ -0,0 +1,120 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Homeparty
*
* @property int $id
* @property Carbon $date
* @property string $name
* @property string $place
* @property string $description
* @property int $pos
* @property int $completed
* @property int $status
* @property bool $order_to
* @property bool $active
* @property bool $default
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Collection|User[] $users
* @package App\Models
* @property int|null $auth_user_id
* @property-read \App\User|null $auth_user
* @property-read \App\Models\HomepartyUser|null $homeparty_host
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\HomepartyUser[] $homeparty_users
* @property-read int|null $homeparty_users_count
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereAuthUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereCompleted($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereDefault($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereOrderTo($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty wherePlace($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereUpdatedAt($value)
* @mixin \Eloquent
*/
class Homeparty extends Model
{
protected $table = 'homeparties';
protected $casts = [
'pos' => 'int',
'completed' => 'int',
'status' => 'int',
'order_to' => 'bool',
'active' => 'bool',
'default' => 'bool'
];
protected $dates = [
'date'
];
protected $fillable = [
'auth_user_id',
'date',
'name',
'place',
'description',
'pos',
'completed',
'status',
'order_to',
'active',
'default'
];
public function auth_user()
{
return $this->belongsTo('App\User', 'auth_user_id');
}
public function homeparty_users()
{
return $this->hasMany('App\Models\HomepartyUser', 'homeparty_id');
}
public function homeparty_host()
{
return $this->hasOne('App\Models\HomepartyUser', 'homeparty_id')->where('is_host', true);
}
public function homeparty_guests()
{
return $this->hasMany('App\Models\HomepartyUser', 'homeparty_id')->where('is_host', false);
}
public function getDateAttribute($value)
{
if (!$value) {
return "";
}
return Carbon::parse($value)->format(\Util::formatDateDB());
}
public function setDateAttribute($value)
{
$this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
}

View file

@ -0,0 +1,192 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class HomepartyUser
*
* @property int $id
* @property int $homeparty_id
* @property int $auth_user_id
* @property bool $is_host
* @property string $billing_salutation
* @property string $billing_company
* @property string $billing_firstname
* @property string $billing_lastname
* @property string $billing_address
* @property string $billing_address_2
* @property string $billing_zipcode
* @property string $billing_city
* @property int $billing_country_id
* @property string $billing_phone
* @property string $billing_email
* @property bool $same_as_billing
* @property string $shipping_salutation
* @property string $shipping_company
* @property string $shipping_firstname
* @property string $shipping_lastname
* @property string $shipping_address
* @property string $shipping_address_2
* @property string $shipping_zipcode
* @property string $shipping_city
* @property int $shipping_country_id
* @property string $shipping_phone
* @property string $shipping_email
* @property bool $has_buyed
* @property bool $subscribed
* @property string $token
* @property bool $token_active
* @property string $notice
* @property string $mode
* @property Carbon $created_at
* @property Carbon $updated_at
* @property string $deleted_at
* @property Carbon $user_deleted_at
* @property User $user
* @property Country $country
* @property Homeparty $homeparty
* @package App\Models
* @property-read \App\User $auth_user
* @property-read \App\Models\Country $billing_country
* @property-read \App\Models\Country $shipping_country
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser newQuery()
* @method static \Illuminate\Database\Query\Builder|\App\Models\HomepartyUser onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereAuthUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingAddress($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingAddress2($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingCity($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingCompany($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingFirstname($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingLastname($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingPhone($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingSalutation($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereBillingZipcode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereHasBuyed($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereHomepartyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereIsHost($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereMode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereNotice($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereSameAsBilling($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingAddress($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingAddress2($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingCity($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingCompany($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingFirstname($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingLastname($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingPhone($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingSalutation($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereShippingZipcode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereSubscribed($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereTokenActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUser whereUserDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\HomepartyUser withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\HomepartyUser withoutTrashed()
* @mixin \Eloquent
*/
class HomepartyUser extends Model
{
use SoftDeletes;
protected $table = 'homeparty_users';
protected $casts = [
'homeparty_id' => 'int',
'auth_user_id' => 'int',
'is_host' => 'bool',
'billing_country_id' => 'int',
'same_as_billing' => 'bool',
'shipping_country_id' => 'int',
'has_buyed' => 'bool',
'subscribed' => 'bool',
'token_active' => 'bool'
];
protected $dates = [
'user_deleted_at'
];
protected $hidden = [
'token'
];
protected $fillable = [
'homeparty_id',
'auth_user_id',
'is_host',
'billing_salutation',
'billing_company',
'billing_firstname',
'billing_lastname',
'billing_address',
'billing_address_2',
'billing_zipcode',
'billing_city',
'billing_country_id',
'billing_phone',
'billing_email',
'same_as_billing',
'shipping_salutation',
'shipping_company',
'shipping_firstname',
'shipping_lastname',
'shipping_address',
'shipping_address_2',
'shipping_zipcode',
'shipping_city',
'shipping_country_id',
'shipping_phone',
'shipping_email',
'has_buyed',
'subscribed',
'token',
'token_active',
'notice',
'mode',
'user_deleted_at'
];
public function homeparty()
{
return $this->belongsTo(Homeparty::class);
}
public function auth_user()
{
return $this->belongsTo(User::class, 'auth_user_id');
}
public function billing_country()
{
return $this->belongsTo('App\Models\Country','billing_country_id');
}
public function shipping_country()
{
return $this->belongsTo('App\Models\Country','shipping_country_id');
}
public function getTokenLink(){
return url('homeparty/'.$this->token);
}
}

View file

@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class Logger
*
*
* @property int $id
* @property int $user_id
* @property int $model_id
@ -23,10 +23,22 @@ use Illuminate\Database\Eloquent\Model;
* @property int $level
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property User $user
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereAction($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereChannel($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereLevel($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereModel($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereModelId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereUserId($value)
* @mixin \Eloquent
*/
class Logger extends Model
{

View file

@ -23,6 +23,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereShippingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereUpdatedAt($value)
* @mixin \Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders
* @property-read int|null $shopping_orders_count
*/
class ShippingCountry extends Model
{

View file

@ -37,6 +37,10 @@ use Illuminate\Database\Eloquent\Model;
* @mixin \Eloquent
* @property-write mixed $tax
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTaxRate($value)
* @property float|null $price_comp
* @property int|null $num_comp
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereNumComp($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice wherePriceComp($value)
*/
class ShippingPrice extends Model
{

View file

@ -30,6 +30,10 @@ use Illuminate\Database\Eloquent\Model;
* @mixin \Eloquent
* @property int|null $payment
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance wherePayment($value)
* @property array|null $shopping_data
* @property string|null $back
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereBack($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereShoppingData($value)
*/
class ShoppingInstance extends Model
{

View file

@ -68,6 +68,18 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withoutTrashed()
* @property-read \App\Models\ShippingCountry $shipping_country
* @property float|null $shipping_net
* @property float|null $subtotal_ws
* @property int|null $points
* @property int|null $shipped
* @property string|null $tracking
* @property string|null $wp_invoice_path
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder wherePoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereShipped($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereShippingNet($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereSubtotalWs($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereTracking($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWpInvoicePath($value)
*/
class ShoppingOrder extends Model
{

View file

@ -41,6 +41,10 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereUserDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem withoutTrashed()
* @property int|null $comp
* @property float|null $price_net
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereComp($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem wherePriceNet($value)
*/
class ShoppingOrderItem extends Model
{

View file

@ -103,6 +103,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingUser withoutTrashed()
* @property string|null $mode
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereMode($value)
* @property bool|null $faker_mail
* @property string|null $shipping_email
* @property string|null $is_for
* @property string|null $is_from
* @property int|null $shopping_user_id
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereFakerMail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereIsFor($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereIsFrom($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShoppingUserId($value)
*/
class ShoppingUser extends Model
{

View file

@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class SySetting
*
*
* @property int $id
* @property string $name
* @property string $slug
@ -22,8 +22,21 @@ use Illuminate\Database\Eloquent\Model;
* @property bool $active
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting findSimilarSlugs($attribute, $config, $slug)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereAction($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereUpdatedAt($value)
* @mixin \Eloquent
*/
class SySetting extends Model
{

View file

@ -2,6 +2,7 @@
namespace App\Services;
use App\Models\UserHistory;
use Illuminate\Support\Str;
use Yard;
class Util
@ -16,6 +17,17 @@ class Util
return hash_hmac('sha256', str_random(40), config('app.key'));
}
public static function uuidToken()
{
$uuid = (string) Str::uuid();
$e_uuid = explode("-", $uuid);
if(isset($e_uuid[0]) && $e_uuid[1]){
return $e_uuid[0]."-".$e_uuid[1];
}
return $uuid;
}
public static function formatDate(){
if(\App::getLocale() === "en"){
return 'yyyy-mm-dd';