403Webshell
Server IP : 54.233.248.239  /  Your IP : 172.28.1.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/EstoqueLog/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

namespace App\Modules\EstoqueLog\Models;

use DB;
use App\MyModel;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
use \Dimsav\Translatable\Translatable;
use App\CampoModulo;
use Sentinel;

class EstoqueLog extends MyModel
{
	use LogsActivity;
	use HasSlug;
	use Translatable;

	protected $table = 'estoque_log';
	protected $guarded = [];
	private $rules = array();
	private $messages = array();
	public $translatedAttributes = [];
	public $translationModel = 'App\Modules\EstoqueLog\Models\EstoqueLogDescricao';

	public function __construct(){
		parent::__construct();
		/*$this->setMessages($this->messages);
		$this->setRules($this->rules);
		$this->translatedAttributes = CampoModulo::join('sis_modulos', 'sis_campo_modulo.id_modulo', '=', 'sis_modulos.id')->where('sis_campo_modulo.translatable', 1)->where('sis_modulos.nome', 'EstoqueLog')->pluck('sis_campo_modulo.nome')->toArray();*/
	}

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

	/**
	* Get the options for generating the slug.
	*/
	public function getSlugOptions() : SlugOptions
	{
		return SlugOptions::create()
		->generateSlugsFrom(['nome', 'titulo'])
		->saveSlugsTo('slug');
	}

	public function getBySlug($slug){
		return DB::table($this->table)->where('slug',$slug)->firstOrFail();
	}

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

		$inser['user_id'] = Sentinel::getUser()->id;

		$estoque_log = new EstoqueLog();
		$estoque_log->fill($insert);
		$estoque_log->save();

		return $estoque_log->id;
	}

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

		$inser['user_id'] = Sentinel::getUser()->id;

		$estoque_log = EstoqueLog::find($id);
		$estoque_log->fill($insert);
		$estoque_log->save();

		return $id;
	}

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


	public function getImagem($id){
		return DB::table($this->table.'_imagens')->find($id);
	}

	public function getImagens($id){
		return DB::table($this->table.'_imagens')->where('id_estoque_log', $id)->get();
	}
	public function criar_imagem($input){
		return DB::table($this->table.'_imagens')->insert([
			[
				'id_estoque_log' => $input['id_estoque_log'],
				'thumbnail_principal' => $input['thumbnail_principal'],
			]
		]);
	}
	public function deletar_imagem($id){
		return DB::table($this->table.'_imagens')
		->where('id', $id)
		->delete();
	}

	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;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit