Файловый менеджер - Редактировать - /home/easybachat/hisabat365.com/4a7891/Imports.zip
Ðазад
PK n?*[xn߶� � ServicesImport.phpnu �Iw�� <?php namespace App\Imports; use App\Service; use App\Item; use App\Tax; use Illuminate\Support\Collection; use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\WithStartRow; use Illuminate\Support\Facades\Validator; class ServicesImport implements ToCollection, WithStartRow { /** * @param Collection $rows */ public function collection(Collection $rows) { $company_id = company_id(); $i = 0; $j = 1; foreach ($rows as $row) { if($row->filter()->isEmpty()){ continue; } Validator::make($rows->toArray(), [ "$i.0" => 'required', "$i.1" => 'required', ],[ "$i.0.required" => _lang('Row No')." $j - "._lang('Service Name field must required'), "$i.1.required" => _lang('Row No')." $j - "._lang('Cost field must required'), ])->validate(); $i++; $j++; //Create Item $item = Item::create([ 'item_name' => $row[0], 'item_type' => 'service', 'company_id' => $company_id, ]); $tax = Tax::where('tax_name',$row[3])->first(); //Create Service $service = Service::create([ 'item_id' => $item['id'], 'cost' => $row[1], 'tax_method' => 'exclusive', 'description' => $row[4], ]); } } /** * @return int */ public function startRow(): int { return 2; } } PK n?*[�J� � LeadsImport.phpnu �Iw�� <?php namespace App\Imports; use App\Lead; use Illuminate\Support\Collection; use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\WithStartRow; use Illuminate\Support\Facades\Validator; use Illuminate\Validation\Rule; use Auth; class LeadsImport implements ToCollection, WithStartRow { private $data; public function __construct(array $data = []) { $this->data = $data; } /** * @param Collection $rows */ public function collection(Collection $rows) { $row_count = count($rows); $company_id = company_id(); $user_id = Auth::id(); $i = 0; $j = 1; foreach ($rows as $row) { if($row->filter()->isEmpty()){ continue; } Validator::make($rows->toArray(), [ "$i.0" => 'required|max:50', "$i.2" => 'nullable|email', "$i.3" => 'required', "$i.7" => 'required|max:3', ],[ "$i.0.required" => _lang('Row No')." $j - "._lang('Name must required'), "$i.0.max" => _lang('Row No')." $j - "._lang('Name field length max 50 character'), "$i.2.email" => _lang('Row No')." $j - "._lang('Email Must be valid'), "$i.3.required" => _lang('Row No')." $j - "._lang('Contact Date must required'), "$i.7.required" => _lang('Row No')." $j - "._lang('Currency field must required'), "$i.7.max" => _lang('Row No')." $j - "._lang('Currency field must be in 3 character'), ])->validate(); $i++; $j++; $lead = new Lead(); $lead->name = $row[0]; $lead->company_name = $row[1]; $lead->email = $row[2]; $lead->lead_status_id = $this->data['lead_status_id']; $lead->lead_source_id = $this->data['lead_source_id']; $lead->assigned_user_id = $this->data['assigned_user_id']; $lead->created_user_id = $user_id; $lead->contact_date = date('Y-m-d', strtotime($row[3])); $lead->phone = '+'.$row[4]; $lead->website = $row[5]; $lead->country = $row[6]; $lead->currency = $row[7]; $lead->vat_id = $row[8]; $lead->reg_no = $row[9]; $lead->city = $row[10]; $lead->state = $row[11]; $lead->zip = $row[12]; $lead->address = $row[13]; $lead->company_id = $company_id; $lead->save(); create_log('leads', $lead->id, _lang('Created Lead')); create_log('leads', $lead->id, _lang('Assign to').' '.$lead->assigned_user->name); } } /** * @return int */ public function startRow(): int { return 2; } } PK n?*[��e?� � ProductsImport.phpnu �Iw�� <?php namespace App\Imports; use App\Product; use App\Item; use App\Stock; use App\Tax; use Illuminate\Support\Collection; use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\WithStartRow; use Illuminate\Support\Facades\Validator; class ProductsImport implements ToCollection, WithStartRow { /** * @param Collection $rows */ public function collection(Collection $rows) { $company_id = company_id(); $i = 0; $j = 1; foreach ($rows as $row) { if($row->filter()->isEmpty()){ continue; } Validator::make($rows->toArray(), [ "$i.0" => 'required', "$i.1" => 'required', "$i.2" => 'required', "$i.3" => 'required', ],[ "$i.0.required" => _lang('Row No')." $j - "._lang('Product Name field must required'), "$i.1.required" => _lang('Row No')." $j - "._lang('Product Cost field must required'), "$i.2.required" => _lang('Row No')." $j - "._lang('Product Price field must required'), "$i.3.required" => _lang('Row No')." $j - "._lang('Product Unit field must required'), ])->validate(); $i++; $j++; //Create Item $item = Item::create([ 'item_name' => $row[0], 'item_type' => 'product', 'company_id' => $company_id, ]); $tax = Tax::where('tax_name',$row[5])->first(); //Create Product $product = Product::create([ 'item_id' => $item['id'], 'product_cost' => $row[1], 'product_price' => $row[2], 'product_unit' => $row[3], 'tax_method' => 'exclusive', 'description' => $row[7], ]); //Create Stock Row Stock::create([ 'product_id' => $item->id, 'quantity' => 0, 'company_id' => $company_id, ]); } } /** * @return int */ public function startRow(): int { return 2; } } PK n?*[��� ContactsImport.phpnu �Iw�� <?php namespace App\Imports; use App\Contact; use App\User; use App\ContactGroup; use Illuminate\Support\Collection; use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\WithStartRow; use Illuminate\Support\Facades\Validator; class ContactsImport implements ToCollection, WithStartRow { private $data; public function __construct(array $data = []) { $this->data = $data; } /** * @param Collection $rows */ public function collection(Collection $rows) { $row_count = count($rows); if( ! available_limit( 'contacts_limit', $row_count ) ){ return back()->with('error', _lang('Sorry, Your contacts limit is not enough !')); } $company_id = company_id(); $i = 0; $j = 1; foreach ($rows as $row) { if($row->filter()->isEmpty()){ continue; } Validator::make($rows->toArray(), [ "$i.0" => 'required|in:Company,Individual', "$i.2" => 'required', "$i.3" => 'required', "$i.8" => 'required|max:3', ],[ "$i.0.required" => _lang('Row No')." $j - "._lang('Profile Type field must required'), "$i.0.in" => _lang('Row No')." $j - "._lang('Profile Type must be Company or Individual'), "$i.2.required" => _lang('Row No')." $j - "._lang('Contact Name field must required'), "$i.3.required" => _lang('Row No')." $j - "._lang('Contact Email field must required'), "$i.8.required" => _lang('Row No')." $j - "._lang('Currency field must required'), "$i.8.max" => _lang('Row No')." $j - "._lang('Currency field must be in 3 character'), ])->validate(); $i++; $j++; $user_id = null; $user = User::where('email',$row[3]) ->where('user_type','client')->first(); if($user){ $user_id = $user->id; } //If Contact email already exists $client = Contact::where('contact_email',$row[3])->first(); if($client){ continue; } //If Contact email already assign to company or staff $other = User::where('email',$row[3]) ->where('user_type','!=','client')->first(); if($other){ continue; } Contact::create([ 'profile_type' => $row[0], 'company_name' => $row[1], 'contact_name' => $row[2], 'contact_email' => $row[3], 'vat_id' => $row[4], 'reg_no' => $row[5], 'contact_phone' => $row[6], 'country' => $row[7], 'currency' => $row[8], 'city' => $row[9], 'state' => $row[10], 'zip' => $row[11], 'address' => $row[12], 'facebook' => $row[13], 'twitter' => $row[14], 'linkedin' => $row[15], 'remarks' => $row[16], 'contact_image' => 'avatar.png', 'group_id' => $this->data['group_id'], 'user_id' => $user_id, 'company_id' => $company_id, ]); } } /** * @return int */ public function startRow(): int { return 2; } } PK n?*[xn߶� � ServicesImport.phpnu �Iw�� PK n?*[�J� � � LeadsImport.phpnu �Iw�� PK n?*[��e?� � ( ProductsImport.phpnu �Iw�� PK n?*[��� ContactsImport.phpnu �Iw�� PK E G$
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка