Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $phones = array(array('phone' => '1234566700', 'status' => 1), array('phone' => '1234566701', 'status' => 1), array('phone' => '1234566702', 'status' => 0));
     foreach ($phones as $phone) {
         $p = new Phone();
         $p->phone = $phone['phone'];
         $p->status = $phone['status'];
         $p->save();
     }
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     $user1 = new User();
     $user1->name = "Sheryl";
     $user1->save();
     $user2 = new User();
     $user2->name = "Sherry";
     $user2->save();
     $user3 = new User();
     $user3->name = "Hilary";
     $user3->save();
     $phone1 = new Phone();
     $phone1->number = '434524';
     $phone1->user_id = 1;
     $phone1->save();
     $phone2 = new Phone();
     $phone2->number = '434524';
     $phone2->user_id = 2;
     $phone2->save();
     $post1 = new Post();
     $post1->content = 'post 1';
     $post1->user_id = 1;
     $post1->save();
     $post2 = new Post();
     $post2->content = 'post 2';
     $post2->user_id = 1;
     $post2->save();
     $post3 = new Post();
     $post3->content = 'post 3';
     $post3->user_id = 2;
     $post3->save();
     $post4 = new Post();
     $post4->user_id = 1;
     $post4->save();
     $post5 = new Post();
     $post5->content = '';
     $post5->user_id = 1;
     $post5->save();
     $photo = new Photo();
     $photo->desc = 'photo 1';
     $user1->photo()->save($photo);
     $photo = new Photo();
     $photo->desc = 'photo 2';
     $phone1->photos()->save($photo);
     $photo = new Photo();
     $photo->desc = 'photo 3';
     $phone1->photos()->save($photo);
     Model::reguard();
 }
Ejemplo n.º 3
0
 public function update($id, array $input, $fileName = '')
 {
     $ship = $this->findById($id);
     // update phone status
     if ($input['news'] == null) {
         $phone = $ship->phone;
         $phone->status = 'warning';
         $phone->save();
         $phone = Phone::find($input['phone']);
         $phone->status = 'success';
         $phone->save();
     }
     // update ship
     $ship->date_submit = Carbon::createFromFormat('d/m/Y', $input['created_at']);
     $ship->phone_id = $input['phone'];
     $ship->number_cv_pa71 = $input['number_cv_pa71'];
     $ship->news = $input['news'];
     $ship->page_news = $input['page_news'];
     $ship->page_list = $input['page_list'];
     $ship->page_xmctb = $input['page_xmctb'];
     $ship->page_imei = $input['page_imei'];
     $ship->receive_name = $input['receive_name'];
     $ship->user_id = $input['user_name'];
     if ($fileName != '') {
         $ship->file_name = $fileName;
     }
     $ship->save();
     // syn network table
     if (isset($input['network'])) {
         $ship->networks()->sync($input['network']);
     }
     return $ship;
 }
Ejemplo n.º 4
0
 public function importExcel()
 {
     $fileInfo = $this->uploadFile(request()->file('file'), 'import');
     $pathToFile = $fileInfo['path'] . '/' . $fileInfo['name'];
     Excel::selectSheets('Sheet1')->load($pathToFile, function ($reader) {
         $rows = $reader->get();
         foreach ($rows as $key => $value) {
             // b1: find order with unit, order_name, order_phone
             $query = DB::table('orders')->join('units', 'orders.unit_id', '=', 'units.id')->join('phones', 'orders.id', '=', 'phones.order_id')->join('purposes', 'orders.purpose_id', '=', 'purposes.id')->where('phones.number', $value['so_dien_thoai'])->where('units.symbol', $value['don_vi_yc'])->where('orders.order_name', 'like', '%' . $value['ho_ten_doi_tuong'] . '%')->where('purposes.group', 'monitor')->select('phones.id');
             $order = $query->first();
             if (isset($order)) {
                 // up date status phone
                 $phone = Phone::find($order->id);
                 if ($phone->status != 'success') {
                     $phone->status = 'success';
                     $phone->save();
                 }
                 $input = $this->excelForShip($value, $order->id);
                 $newShip = new ShipRepository(new Ship());
                 $newShip->create($input);
             }
         }
     });
     return redirect()->back();
 }
Ejemplo n.º 5
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $formattedEraserList = generateEraserList($this->eraserList);
     foreach ($formattedEraserList as $device) {
         //Create the Phone model
         $phone = Phone::firstOrCreate(['mac' => $device['DeviceName'], 'description' => $device['Description']]);
         //Start creating Eraser
         $tleObj = Eraser::create(['phone_id' => $phone->id, 'ip_address' => $device['IpAddress'], 'eraser_type' => $device['type']]);
         if (isset($device['bulk_id'])) {
             $tleObj->bulks()->attach($device['bulk_id']);
         }
         if ($device['IpAddress'] == "Unregistered/Unknown") {
             $tleObj->result = 'Fail';
             $tleObj->failure_reason = 'Unregistered/Unknown';
             $tleObj->save();
             continue;
         }
         $keys = setKeys($device['Model'], $device['type']);
         if (!$keys) {
             $tleObj->result = 'Fail';
             $tleObj->failure_reason = 'Unsupported Model';
             $tleObj->save();
             return;
         }
         $dialer = new PhoneDialer($device['IpAddress']);
         $status = $dialer->dial($tleObj, $keys);
         //Successful if returned true
         $passFail = $status ? 'Success' : 'Fail';
         $tleObj->result = $passFail;
         $tleObj->save();
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DatabaseSeeder::truncateTable('phones');
     $authors = \App\Author::all();
     foreach ($authors as $author) {
         \App\Phone::create(['author_id' => $author->id, 'phone_number' => '0' . (string) (9099990000 + $author->id)]);
     }
 }
Ejemplo n.º 7
0
 public static function search()
 {
     $SELECT = 'SELECT p.phone_id, p.nazwa, g.filename FROM phone p, galeria g WHERE p.phone_id = g.phone_id AND ';
     $questions = json_decode($_COOKIE['questions']);
     for ($i = 0, $c = count($questions); $i < $c; $i++) {
         if ($questions[$i] != null) {
             switch ($i + 1) {
                 case 1:
                     $price = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($price, "cena");
                     break;
                 case 2:
                     $SELECT .= "p.rodzaj = " . $questions[$i] . " AND ";
                     break;
                 case 3:
                     $SELECT .= "p.system = " . $questions[$i] . " AND ";
                     break;
                 case 4:
                     $display = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($display, "p.wyswietlacz");
                     break;
                 case 5:
                     $procesor_takt = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($procesor_takt, "p.procesor_takt");
                     break;
                 case 6:
                     $SELECT .= "p.procesor_rdzenie = " . $questions[$i] . " AND ";
                     break;
                 case 7:
                     $ram = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($ram, "p.ram");
                     break;
                 case 8:
                     $pamiec_wew = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($pamiec_wew, "p.pamiec_wew");
                     break;
                 case 9:
                     $bateria = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($bateria, "p.bateria_mah");
                     break;
                 case 10:
                     $aparat = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($aparat, "p.aparat_mpx");
                     break;
                 case 11:
                     $SELECT .= "p.wifi = " . $questions[$i] . " AND ";
                     break;
                 case 12:
                     $SELECT .= "p.lte = " . $questions[$i] . " AND ";
                     break;
             }
         }
     }
     $SELECT .= "1 ORDER BY p.nazwa";
     return DB::select($SELECT);
 }
Ejemplo n.º 8
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('phone', function ($mac) {
         return \App\Phone::where('mac', $mac)->first();
     });
     $router->bind('bulk', function ($process_id) {
         return \App\Bulk::where('process_id', $process_id)->first();
     });
 }
Ejemplo n.º 9
0
 public static function findRequested()
 {
     $query = Phone::query();
     // search results based on user input
     \Request::input('id') and $query->where('id', \Request::input('id'));
     \Request::input('model') and $query->where('model', 'like', '%' . \Request::input('model') . '%');
     \Request::input('manufacturer') and $query->where('manufacturer', 'like', '%' . \Request::input('manufacturer') . '%');
     \Request::input('operating_system') and $query->where('operating_system', \Request::input('operating_system'));
     \Request::input('created_at') and $query->where('created_at', \Request::input('created_at'));
     \Request::input('updated_at') and $query->where('updated_at', \Request::input('updated_at'));
     \Request::input('release_date') and $query->where('release_date', \Request::input('release_date'));
     // sort results
     \Request::input("sort") and $query->orderBy(\Request::input("sort"), \Request::input("sortType", "asc"));
     // paginate results
     return $query->paginate(15);
 }
Ejemplo n.º 10
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $macList = array_column($this->eraserArray, 'MAC');
     $phoneList = new PreparePhoneList();
     $risPortResults = $phoneList->createList($macList);
     foreach ($this->eraserArray as $row) {
         $key = array_search($row['MAC'], array_column($risPortResults, 'DeviceName'));
         $risPortResults[$key]['TLE'] = $row['TLE'];
         $risPortResults[$key]['BULK_ID'] = $row['BULK_ID'];
     }
     //Loop Devices and erase Trust List
     foreach ($risPortResults as $device) {
         //Create the Phone model
         $phone = Phone::firstOrCreate(['mac' => $device['DeviceName'], 'description' => $device['Description']]);
         //Start creating Eraser
         $tleObj = Eraser::create(['phone_id' => $phone->id, 'ip_address' => $device['IpAddress'], 'eraser_type' => $device['TLE']]);
         $tleObj->bulks()->attach($device['BULK_ID']);
         if ($device['IpAddress'] == "Unregistered/Unknown") {
             //Not registered, save as failed
             $tleObj->result = 'Fail';
             $tleObj->failure_reason = 'Unregistered/Unknown';
             $tleObj->save();
             Log::info('Device Unregistered/Unknown.', [$device]);
             continue;
         }
         /*
          * Get the key press series
          */
         $keys = setKeys($device['Model'], $tleObj->eraser_type);
         Log::info('setKeys(),$keys', [$tleObj->eraser_type]);
         if (!$keys) {
             $tleObj->result = 'Fail';
             $tleObj->failure_reason = 'Unsupported Model';
             $tleObj->save();
             return;
         }
         $dialer = new PhoneDialer($device['IpAddress']);
         //Dial the keys
         $status = $dialer->dial($tleObj, $keys);
         //Successful if returned true
         $passFail = $status ? 'Success' : 'Fail';
         $tleObj->result = $passFail;
         $tleObj->save();
         return;
     }
 }
Ejemplo n.º 11
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('phone', function ($mac) {
         return \App\Phone::where('mac', $mac)->first();
     });
     $router->bind('bulk', function ($process_id) {
         return \App\Bulk::where('process_id', $process_id)->first();
     });
     $router->bind('cluster', function ($id) {
         return \App\Cluster::where('id', $id)->first();
     });
     $router->bind('user', function ($name) {
         return \App\User::where('name', $name)->first();
     });
     $router->bind('sql', function ($id) {
         return \App\Sql::where('id', $id)->first();
     });
 }
Ejemplo n.º 12
0
 public function changeContactInfo(Request $request)
 {
     if ($request->type == 'contact') {
         $item = Contact::find($request->entity);
         if ($request->name == 'first_name') {
             $item->first_name = $request->value;
         } elseif ($request->name == 'last_name') {
             $item->last_name = $request->value;
         } elseif ($request->name == 'email') {
             $item->email = $request->value;
         } elseif ($request->name == 'title') {
             $item->title = $request->value;
         } else {
         }
         $item->save();
     } elseif ($request->type == 'address') {
         $item = Address::find($request->entity);
         $item->full_string = $request->value;
         $item->save();
         return $request->all();
     } elseif ($request->type == 'phone') {
         $item = Phone::find($request->entity);
         if ($request->name == 'type') {
             $item->type = $request->value;
         } elseif ($request->name == 'number') {
             $item->number = $request->value;
         } elseif ($request->name == 'from') {
             $item->available_from = $request->value;
         } elseif ($request->name == 'to') {
             $item->available_to = $request->value;
         } else {
         }
         $item->save();
         return $request->all();
     } else {
     }
 }
Ejemplo n.º 13
0
 public function phoneUpload(Request $request)
 {
     if ($request->hasFile('phonefile')) {
         $date = Carbon::now()->format("Y_m_d");
         $path = base_path() . "/up/" . "Phone/" . $date . "/";
         $ext = $request->file('phonefile')->getClientOriginalExtension();
         $extmine = $request->file('phonefile')->getClientMimeType();
         $exts = collect(['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
         if ($exts->contains($extmine)) {
             $request->file('phonefile')->move($path, Carbon::now()->timestamp . "." . $ext);
             $filename = $path . Carbon::now()->timestamp . "." . $ext;
             /* Import Excel file*/
             Excel::load($filename, function ($reader) {
                 $rule = ['number' => 'required|unique:phones'];
                 $sheetsCount = $reader->getSheetCount();
                 for ($i = 0; $i < $sheetsCount; $i++) {
                     $sheets = $reader->getSheet($i)->toArray();
                     $sheetCount = count($sheets);
                     for ($j = 1; $j < $sheetCount; $j++) {
                         /*
                         *  $table->integer('company_id')->unsigned();
                            $table->boolean('isShared')->default(false);
                            $table->string('department_name')->nullable();
                            $table->boolean('isActived')->default(true);
                            $table->string('number')->unique();
                            $table->integer('payment_company_id')->unsigned();
                            $table->integer('category_id')->unsigned();
                         */
                         if ($sheets[$j][6] == 'EXT_CDMA') {
                             $data['number'] = trim($sheets[$j][1]);
                             $data['company_id'] = Company::where('name', trim($sheets[$j][3]))->value('id');
                             $data['payment_company_id'] = $data['company_id'];
                             $data['category_id'] = PhoneCategory::where('name', 'CDMA')->value('id');
                             $data['department_name'] = $sheets[$j][4];
                             $validator = \Validator::make($data, $rule);
                             if ($validator->fails()) {
                             } else {
                                 Phone::create($data);
                             }
                         }
                         /* $validator=\Validator::make($data,$rule);
                                                 if($validator->fails()){
                         
                                                 }else{
                         
                                                 }*/
                     }
                 }
             });
         } else {
             return back()->with('message', '文件格式不对');
         }
     }
     return back();
 }
 public function dodajget()
 {
     $count = Phone::getPhonesCount();
     $phones = Phone::getAllPhones();
     return view('dodaj', ['count' => $count, 'phones' => $phones]);
 }
 public function index()
 {
     dd(Phone::find(4)->user);
 }
Ejemplo n.º 16
0
 public function phone($id)
 {
     Phone::find($id)->delete();
     return back();
 }
Ejemplo n.º 17
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, User $user)
 {
     if ($user->cannot('edit', $user)) {
         return redirect('users');
     }
     //if(auth()->user()->id != $user->id) return redirect('users');
     $this->validate($request, ['name' => 'required|max:30', 'email' => 'required|max:60|email|unique:users,email,' . $user->id, 'country_id' => 'integer|max:3', 'phone' => 'string']);
     //$user->name = $request->name;//2
     //$user->email = $request->email;//2
     //$user->country()->associate($request->country_id);//2//update a belongs to
     //$user->save();//2
     if ($user->phone) {
         //->user_id
         Phone::where('user_id', $user->id)->update(['name' => $request->phone]);
     } else {
         Phone::create(['user_id' => $user->id, 'name' => $request->phone]);
         //1
     }
     $user->roles()->sync(!$request->input('role_list') ? [] : $request->input('role_list'));
     $user->update($request->all());
     //1
     return redirect('users/' . $user->id);
 }
Ejemplo n.º 18
0
 public function testDelete()
 {
     // test delete()
     $phone = Phone::find(1);
     $this->assertNotNull($phone);
     $phone = Phone::find(1);
     $phone->delete();
     $phone = Phone::find(1);
     $this->assertNull($phone);
     // test delete() with query builder
     // Post is soft delete model
     $posts = Post::where('id', '<', 3)->get();
     $this->assertFalse($posts->isEmpty());
     Post::where('id', '<', 3)->delete();
     $posts = Post::where('id', '<', 3)->get();
     $this->assertTrue($posts->isEmpty());
     // test destroy()
     $phone = Phone::find(2);
     $this->assertNotNull($phone);
     Phone::destroy(2);
     $phone = Phone::find(2);
     $this->assertNull($phone);
     $photos = Photo::all();
     $this->assertFalse($photos->isEmpty());
     Photo::destroy([1, 2, 3]);
     $photos = Photo::all();
     $this->assertTrue($photos->isEmpty());
     // test destopy with non-existing primary key
     // expect no exception
     Photo::destroy([1, 2, 3]);
     $photos = Photo::all();
     $this->assertTrue($photos->isEmpty());
 }
Ejemplo n.º 19
0
 public function testMorphHas()
 {
     $user = User::find(1);
     $photo = $user->photo;
     $this->assertInstanceOf('App\\Photo', $photo);
     $phone = Phone::find(1);
     $photos = $phone->photos;
     $this->assertSame(FALSE, $photos->isEmpty());
 }
Ejemplo n.º 20
0
 public function getRegister()
 {
     $available_phones = Phone::where('status', 1)->take(50)->lists('phone', 'id');
     return view('user.create')->with('available_phones', $available_phones->all());
 }
Ejemplo n.º 21
0
 /**
  * Remove the specified resource from storage.
  *
  * @return  \Illuminate\Http\Response
  */
 public function destroy(Request $request, Phone $phone)
 {
     $phone->delete();
     return redirect('/phone');
 }
Ejemplo n.º 22
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  Phone $phone
  * @return \Illuminate\Http\Response
  */
 public function destroy(Phone $phone)
 {
     //
     $phone->delete();
     return Redirect::route('stations.show', $station->slug)->with('message', 'Phone deleted.');
 }
Ejemplo n.º 23
0
 public function createLead(Request $request)
 {
     $lead = new Lead();
     $lead->name = $request->name;
     $lead->activity_setting = $request->setting;
     if ($request->next_action) {
         $lead->next_action = Carbon::createFromFormat('m/d/Y g:i A', $request->next_action)->toDateTimeString();
     } else {
         $lead->next_action = null;
     }
     $lead->active = 1;
     $lead->progress = 0;
     $lead->level = 0;
     $lead->save();
     $entity = new Entity();
     $entity->name = $request->entity['name'];
     $entity->type = $request->entity['type'];
     $entity->save();
     $lead->entity_id = $entity->id;
     $lead->save();
     $user = User::find($request->userId);
     $user->leads()->attach($lead);
     $account = Account::find($user->account_id);
     $account->entities()->attach($entity);
     foreach ($request->entity['entity_data'] as $eData) {
         $entityData = new EntityData();
         $entityData->key = $eData['key'];
         $entityData->value = $eData['value'];
         $entityData->name = $eData['name'];
         $entityData->entity_id = $entity->id;
         $entityData->type = strtolower($eData['type']);
         //TODO
         $entityData->save();
     }
     foreach ($request->entity['contacts'] as $cntct) {
         $contact = new Contact();
         $contact->email = $cntct['email'];
         $contact->first_name = $cntct['first_name'];
         $contact->last_name = $cntct['last_name'];
         $contact->title = $cntct['title'];
         $contact->type = $cntct['type'];
         $contact->entity_id = $entity->id;
         $contact->save();
         foreach ($cntct['addresses'] as $adr) {
             $address = new Address();
             $address->name = $adr['name'];
             $address->full_string = $adr['full_string'];
             $address->contact_id = $contact->id;
             $address->save();
             foreach ($adr['phones'] as $ph) {
                 $phone = new Phone();
                 $phone->number = $ph['number'];
                 $phone->available_from = $ph['available_from'];
                 $phone->available_to = $ph['available_to'];
                 $phone->type = $ph['type'];
                 $phone->address_id = $address->id;
                 $phone->save();
             }
         }
     }
     $activity = new Activity();
     $activity->lead_id = $lead->id;
     $activity->user_id = $user->id;
     $activity->type = 'info';
     $activity->status = 'done';
     $activity->name = 'Created';
     $activity->visible = 1;
     $activity->note = $request->note;
     $activity->schedule_time = Carbon::now()->toDateTimeString();
     $activity->save();
 }
Ejemplo n.º 24
0
 public function phones($num, $address_id = null, $contact_id = null)
 {
     for ($i = 0; $i < $num; $i++) {
         $item = new Phone();
         $item->number = $this->faker->phoneNumber;
         $item->code = $this->faker->numberBetween(100, 999);
         $item->type = $this->faker->randomElement($array = array('mobile', 'home', 'office'));
         $item->available_from = $this->faker->time($format = 'H:i', $max = 'now');
         $item->available_to = $this->faker->time($format = 'H:i', $max = 'now');
         $item->address_id = $address_id;
         $item->contact_id = $contact_id;
         $item->save();
     }
 }
Ejemplo n.º 25
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $phone = Phone::find($id);
     return view('phone.edit')->with('phone', $phone);
 }
Ejemplo n.º 26
0
 public function updateStatus(Request $request, $phoneId)
 {
     $phone = Phone::find($phoneId);
     $order = $this->order->findById($phone->order_id);
     $order->comment = $request->get('comment');
     $order->save();
     $phone->status = $request->get('status');
     $phone->save();
     return redirect()->back();
 }
Ejemplo n.º 27
0
 private function storeStudentIndividual()
 {
     $var = DB::transaction(function ($connection) {
         $membership_period = Input::get('membership-period');
         $salutation = Input::get('salutation');
         $fname = Input::get('fname');
         $mname = Input::get('mname');
         $lname = Input::get('lname');
         $card_name = Input::get('card_name');
         $dob = Input::get('dob');
         $gender = Input::get('gender');
         $country = Input::get('country');
         $state = Input::get('state');
         $address = Input::get('address');
         $city = Input::get('city');
         $pincode = Input::get('pincode');
         $stud_branch = Input::get('stud_branch');
         $college = Input::get('college');
         $course = Input::get('course');
         $cbranch = Input::get('cbranch');
         $cduration = Input::get('cduration');
         $email1 = Input::get('email1');
         $email2 = Input::get('email2');
         $std = Input::get('std');
         $phone = Input::get('phone');
         $country_code = Input::get('country-code');
         $mobile = Input::get('mobile');
         $paymentMode = Input::get('paymentMode');
         $tno = Input::get('tno');
         $drawn = Input::get('drawn');
         $bank = Input::get('bank');
         $branch = Input::get('branch');
         $paymentReciept = Input::file('paymentReciept');
         $amountPaid = Input::get('amountPaid');
         $student_branch = AcademicMember::Where('is_student_branch', $stud_branch)->first();
         $chapter = $student_branch->institution->member->csi_chapter_id;
         $member = new Member();
         $member->membership_id = 2;
         // individual member
         $membership_type = 3;
         // student member
         $member->csi_chapter_id = $chapter;
         $member->email = $email1;
         $member->email_extra = $email2;
         $member->password = bcrypt('1234');
         $member->save();
         $member->id;
         $filename = $member->id . '.';
         $filename .= $paymentReciept->getClientOriginalExtension();
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => $country, 'state_code' => $state, 'address_line_1' => $address, 'city' => $city, 'pincode' => $pincode]);
         Phone::create(['member_id' => $member->id, 'std_code' => $std, 'landline' => $phone, 'country_code' => $country_code, 'mobile' => $mobile]);
         $paymentReciept->move(storage_path('uploads/payment_proofs'), $filename);
         $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => $membership_type, 'salutation_id' => $salutation, 'first_name' => $fname, 'middle_name' => $mname, 'last_name' => $lname, 'card_name' => $card_name, 'gender' => $gender, 'dob' => $dob]);
         $student_details = StudentMember::create(['id' => $individual->id, 'student_branch_id' => $student_branch->id, 'college_name' => $college, 'course_name' => $course, 'course_branch' => $cbranch, 'course_duration' => $cduration]);
         // 2nd arg is currency.. needs to be queried to put here
         $head = PaymentHead::getHead($membership_period, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => $paymentMode, 'transaction_number' => $tno, 'bank' => $bank, 'branch' => $branch, 'date_of_payment' => $drawn, 'drafted_amount' => $head->amount, 'paid_amount' => $amountPaid, 'proof' => $filename]);
         $journal = Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id]);
         if (!is_null($member->id) && $member->id > 0) {
             $user = $member;
         }
         return $member;
     });
     return $var;
 }
Ejemplo n.º 28
0
 public function statisticsAction()
 {
     return Phone::with('order', 'ships', 'order.unit')->whereHas('order.purpose', function ($q) {
         $q->where('group', 'monitor');
     })->where('status', 'success')->get();
 }
Ejemplo n.º 29
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     /**
      * academic institution
      */
     factory(Member::class, 'institution', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => 1, 'salutation_id' => 1, 'name' => $faker->company, 'head_name' => $faker->name, 'head_designation' => $faker->word, 'email' => $faker->email, 'mobile' => 1234567890]);
         $this->command->info('institution done!');
         AcademicMember::create(['id' => $institution->id, 'institution_type_id' => 2]);
         $this->command->info('academic done!');
         $head = PaymentHead::getHead(1, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
     /**
      * non academic institution
      */
     factory(Member::class, 'institution', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => 2, 'salutation_id' => 1, 'name' => $faker->company, 'head_name' => $faker->name, 'head_designation' => $faker->word, 'email' => $faker->email, 'mobile' => 1234567890]);
         $this->command->info('institution done!');
         $head = PaymentHead::getHead(9, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
     /**
      * professional individual
      */
     factory(Member::class, 'individual', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => 4, 'salutation_id' => $faker->randomElement(range(1, 5)), 'first_name' => $faker->firstName, 'middle_name' => $faker->word, 'last_name' => $faker->lastname, 'card_name' => $faker->name, 'gender' => $faker->randomElement(['m', 'f']), 'dob' => $faker->date('d/m/Y')]);
         $this->command->info('individual done!');
         $professional = ProfessionalMember::create(['id' => $individual->id, 'organisation' => $faker->company, 'designation' => $faker->word]);
         $this->command->info('professional done!');
         $head = PaymentHead::getHead(17, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
     /**
      * academic individual
      */
     factory(Member::class, 'individual', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => 3, 'salutation_id' => $faker->randomElement(range(1, 5)), 'first_name' => $faker->firstName, 'middle_name' => $faker->word, 'last_name' => $faker->lastname, 'card_name' => $faker->name, 'gender' => $faker->randomElement(['m', 'f']), 'dob' => $faker->date('d/m/Y')]);
         $this->command->info('individual done!');
         $student_details = StudentMember::create(['id' => $individual->id, 'student_branch_id' => 1, 'college_name' => $faker->company, 'course_name' => $faker->word, 'course_branch' => $faker->word, 'course_duration' => 3]);
         $this->command->info('student done!');
         $head = PaymentHead::getHead(21, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
 }
Ejemplo n.º 30
0
 public function getIndex()
 {
     $phones = Phone::all();
     var_dump($phones);
 }