config(strtolower($module->name).'.fa_name'),'icon'=> config(strtolower($module->name).'.icon'),'subs'=>config(strtolower($module->name).'.subs')];
}
$data = explode('/',url()->current());
$data = implode('/',array_splice($data,0,count($data)-1));
View::share('sidebar', $sidebar);
View::share('redirectBack', $data);
}
static public function attachmentProcess($request,$object){
foreach ($request->file() as $name => $file) {
if (is_array($file)) {
$i = 0;
foreach ($file as $item) {
$i++;
$path = $item->store($object->getTable());
$object->attachments()->updateOrCreate([
'filename' => $name . $i,
],[
'path' => $path,
'mime' => $item->extension(),
'uid'=>uniqid($object->getTable())]);
}
} else {
$path = $file->store($object->getTable());
$object->attachments()->updateOrCreate([
'filename' => $name,
],[
'path' => $path,
'mime' => $file->extension(),
'uid'=>uniqid($object->getTable())]);
}
}
return true;
}
static public function multi_attachments_process($request,$object){
foreach ($request->file() as $name => $file) {
if (is_array($file)) {
$i = 0;
foreach ($file as $item) {
$i++;
$path = $item->store($object->getTable());
$object->attachments()->create([
'filename' => $name . $i,
'path' => $path,
'mime' => $item->extension(),
'uid'=>uniqid($object->getTable())]);
}
} else {
$path = $file->store($object->getTable());
$object->attachments()->create([
'filename' => $name,
'path' => $path,
'mime' => $file->extension(),
'uid'=>uniqid($object->getTable())]);
}
}
return true;
}
static public function documentProcess( $request,$object){
foreach ($request->file() as $name => $file) {
if (is_array($file)) {
$i = 0;
foreach ($file as $item) {
$i++;
$path = $item->store($object->getTable());
$object->documents()->updateOrCreate([
'filename' => $name . $i,
],[
'path' => $path,
'mime' => $item->extension(),
'uid'=>uniqid($object->getTable())]);
}
} else {
$path = $file->store($object->getTable());
$object->documents()->updateOrCreate([
'filename' => $name,
],[
'path' => $path,
'mime' => $file->extension(),
'uid'=>uniqid($object->getTable())]);
}
}
return true;
}
static public function redirectAction($href,$title,$btn_color='primary'){
$html = ' '.$title.' ' ;
return $html;
}
static public function deleteAction($id){
return '';
}
static public function datatableModal($title,$html){
$res = "".$title.'';
return $res;
}
static public function selectValue($data){
$class = explode('@',$data)[0];
$function = explode('@',$data)[1];
return $class::$function();
}
static public function sendMessage($message , $to){
$txt="به فابریکا خوش آمدید
کد ورود شما : ".$message;
$url = "https://ippanel.com/services.jspd";
$rcpt_nm = array('+989011739919');
$param = array
(
'uname'=>'f09124307101',
'pass'=>'tjzfh574',
'from'=>'+9810009589',
'message'=>'تست',
'to'=>json_encode($rcpt_nm),
'op'=>'send'
);
$handler = curl_init($url);
curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($handler, CURLOPT_POSTFIELDS, $param);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
$response2 = curl_exec($handler);
$response2 = json_decode($response2);
$res_code = $response2[0];
$res_data = $response2[1];
}
static public function paginateCollection($items, $perPage = 15, $page = null, $options = [])
{
$page = $page ?: (\Illuminate\Pagination\Paginator::resolveCurrentPage() ?: 1);
$items = $items instanceof \Illuminate\Support\Collection ? $items : \Illuminate\Support\Collection::make($items);
return new \Illuminate\Pagination\LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
}
}