403Webshell
Server IP : 54.94.228.101  /  Your IP : 172.28.20.13
Web Server : Apache
System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/vinumday2_0/app/Modules/Adega/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/vinumday2_0/app/Modules/Adega/Models/Adega.php
<?php

namespace App\Modules\Adega\Models;

use DB;
use App\MyModel;
use Spatie\Activitylog\Traits\LogsActivity;
use App\CampoModulo;

class Adega extends MyModel
{
	//use LogsActivity;

	protected $table   = 'adega';
	protected $guarded = [];
	private $rules     = array();
	private $messages  = array();

	public function __construct(){
		parent::__construct();
		$this->setMessages($this->messages);
		$this->setRules($this->rules);
	}

	public function getLogNameToUse(string $eventName = ''): string
	{
		return 'log_adega';
	}

	public function criar($fields, $input){
		$insert = [];
		foreach ($fields as $field) {
			$insert[$field] = $input[$field];
		}

		$adega = new Adega();
		$adega->fill($insert);
		$adega->save();

		return $adega->id;
	}

	public function editar($fields, $input, $id){
		$insert = [];
		foreach ($fields as $field) {
			$insert[$field] = $input[$field];
		}

		$adega = Adega::find($id);
		$adega->fill($insert);
		$adega->save();

		return $id;
	}

	public function deletar($id){
		$adega = Adega::find($id);
		$adega->delete();
		return true;
	}

	public function getNextAutoIncrement(){
		$lastId = DB::select("SELECT AUTO_INCREMENT FROM information_schema.tables WHERE TABLE_NAME = '$this->table' ORDER BY table_name;")[0]->AUTO_INCREMENT;
		return $lastId;
	}

	public function cliente(){
		return $this->belongsTo('App\Modules\Cadastro\Models\Cadastro', 'id_cliente');
	}

	public function endereco(){
		return $this->belongsTo('App\Modules\CadastroEndereco\Models\CadastroEndereco', 'cadastro_endereco_id');
	}

	public function confraria(){
		return $this->belongsTo('App\Modules\Confraria\Models\Confraria', 'confraria_id');
	}

	public function pedidoEntrega(){
		return $this->hasOne('App\Modules\PedidoEntrega\Models\PedidoEntrega', 'id_adega');
	}

	public function pedidos(){
		return $this->hasMany('App\Modules\AdegaHasPedidoVenda\Models\AdegaHasPedidoVenda', 'id_adega');
	}

	public function pedidosPendentes(){
		return $this->hasMany('App\Modules\AdegaHasPedidoVenda\Models\AdegaHasPedidoVenda', 'id_adega')->select('adega_has_pedido_venda.*')->join('pedido_venda', 'adega_has_pedido_venda.id_pedido_venda', '=', 'pedido_venda.id')->where('pedido_venda.id_status_pedido_venda', 1);
	}

	public function pedidosPreVenda(){
		return $this->hasMany('App\Modules\AdegaHasPedidoVenda\Models\AdegaHasPedidoVenda', 'id_adega')->select('adega_has_pedido_venda.*')->join('pedido_venda', 'adega_has_pedido_venda.id_pedido_venda', '=', 'pedido_venda.id')->where('pedido_venda.id_status_pedido_venda', 9);
	}

	public function pedidosAprovados(){
		return $this->hasMany('App\Modules\AdegaHasPedidoVenda\Models\AdegaHasPedidoVenda', 'id_adega')->select('adega_has_pedido_venda.*')->join('pedido_venda', 'adega_has_pedido_venda.id_pedido_venda', '=', 'pedido_venda.id')->where('pedido_venda.id_status_pedido_venda', 2);
	}

	public function pedidosParciais(){
		return $this->hasMany('App\Modules\AdegaHasPedidoVenda\Models\AdegaHasPedidoVenda', 'id_adega')->select('adega_has_pedido_venda.*')->join('pedido_venda', 'adega_has_pedido_venda.id_pedido_venda', '=', 'pedido_venda.id')->where('pedido_venda.parcial', 1)->where('pedido_venda.id_status_pedido_venda', 1);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit