Esempio n. 1
1
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param Vendor $vendor
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, Vendor $vendor)
 {
     $this->validate($request, ['name' => 'required|unique:categories', 'slug' => 'required|unique:categories']);
     $input = $request->except(['_token']);
     $vendor->fill($input)->save();
     return redirect('vendors')->with('success', 'Vendor successfully added.');
 }
 public function get($token)
 {
     $retval = array();
     $retval['status'] = 1;
     $options = Input::only('fields');
     $vendor = new Vendor();
     $cell = $vendor->getCellNumber($token);
     $settings = new Settings();
     if (isset($options['fields'])) {
         $filters = explode(',', $options['fields'], Settings::NUM_SETTINGS + 1);
         foreach ($filters as $name) {
             $retval[$name] = $settings->get($cell, $name);
         }
     }
     return $retval;
 }
Esempio n. 3
0
 public function lists()
 {
     // ------------------------------------------------------------------------------------------------------------
     // DIAMOND VENDORS
     // ------------------------------------------------------------------------------------------------------------
     $vendors['diamond'] = Vendor::inCategories(8)->orderBy('name')->get();
     // ------------------------------------------------------------------------------------------------------------
     // GOLD VENDORS
     // ------------------------------------------------------------------------------------------------------------
     $vendors['gold'] = Vendor::inCategories(9)->orderBy('name')->get();
     // ------------------------------------------------------------------------------------------------------------
     // SILVER VENDORS
     // ------------------------------------------------------------------------------------------------------------
     $vendors['silver'] = Vendor::inCategories(10)->orderBy('name')->get();
     // ------------------------------------------------------------------------------------------------------------
     // BRONZE VENDORS
     // ------------------------------------------------------------------------------------------------------------
     $vendors['bronze'] = Vendor::NoSubscription()->orderBy('name')->get();
     // ------------------------------------------------------------------------------------------------------------
     // SHOW DISPLAY
     // ------------------------------------------------------------------------------------------------------------
     $this->layout->page = view($this->page_base_dir . 'vendor.index');
     $this->layout->page->vendors = $vendors;
     $this->init_right_sidebar();
     return $this->layout;
 }
 public function home()
 {
     $stats['employees'] = \App\Employee::count();
     $stats['assets'] = \App\Asset::count();
     $stats['users'] = \App\User::count();
     $stats['vendors'] = \App\Vendor::count();
     return View('pages.dashboard', compact('stats'));
 }
 /**
  * Vendor delete via api DELETE
  *
  * @return void
  */
 public function testDelete()
 {
     $vendor = factory(App\Vendor::class)->create();
     $this->delete('/api/vendor/' . $vendor->id)->seeJson(['status' => 'success']);
     // check db
     $vendor = Vendor::find($vendor->id);
     $this->assertNull($vendor);
 }
 function newsale(Request $request)
 {
     $values = $request->all();
     $sale = Sale::create($values);
     $sales = Sale::all();
     $items = Item::all();
     $vendors = Vendor::all();
     return view('stockmaster.sales', ['vendors' => $vendors, 'newsale' => $sale, 'items' => $items, 'user' => Auth::user()]);
 }
Esempio n. 7
0
 public function lapanganRegister(Request $request)
 {
     $rules = array('harga' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return view('views')->withErrors($validator);
     } else {
         $input = $request->all();
         $register = lapangan::create($input);
         $tipe_lapangan = $input['tipe_id'];
         $data = ['tipe_id' => $input['tipe_id'], 'harga' => $input['harga'], 'vendor_id' => $input['vendor_id']];
         $vendor = DB::table('vendors')->get();
         $lap_jenis = tipe_lap::lists('tipe', 'id');
         $vendor_name = Vendor::lists('nama', 'id');
         return view('admin.views', ['vendor' => $vendor], compact('lap_jenis', 'vendor_name'))->withSuccess('Lapangan Berhasil Ditambahkan');
     }
 }
Esempio n. 8
0
 public function generate($vendor_slug, $tour_slug, $schedule_id)
 {
     // -------------------------------------------------
     // check vendor
     // -------------------------------------------------
     $vendor = Vendor::SlugIs($vendor_slug)->first();
     if (!$vendor) {
         App::abort(404);
     }
     // -------------------------------------------------
     // check tour
     // -------------------------------------------------
     $tour = $vendor->tours()->slugIs($tour_slug)->first();
     if (!$tour) {
         App::abort(404);
     }
     // -------------------------------------------------
     // schedule
     // -------------------------------------------------
     $schedule = $tour->schedules()->find($schedule_id);
     if (!$schedule) {
         App::abort(404);
     }
     // -------------------------------------------------
     // generate voucher
     // -------------------------------------------------
     $book = Book::where('user_id', '=', Auth::id())->ofSchedule($schedule->id)->first();
     if (!$book) {
         $book = new Book();
         $book->fill(['discount_currency' => $schedule->currency, 'discount' => $schedule->discount, 'discount_code' => str_random(6), 'user_id' => Auth::id(), 'schedule_id' => $schedule->id]);
         if (!$book->save()) {
             return redirect()->back()->withErrors($book->getErrors);
         }
     }
     return redirect()->route('web.me.index');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Vendor::destroy($id);
     flash()->success('Success!', 'Vendor has been deleted!');
     return redirect('vendors');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function retrieveAll($token, $counter)
 {
     # Get the cell number
     $vendor = new Vendor();
     $cell = $vendor->getCellNumber($token);
     $apointment = new Appointments();
     return $apointment->retrieveAll($cell, $counter);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Request $request, $id)
 {
     // delete a specific vendor
     $vendor = Vendor::with('codes', 'transactions')->find($id);
     if (!$vendor->transactions->isEmpty()) {
         return response(array('status' => 'error', 'msg' => 'Cannot delete a vendor with transactions!'), 400);
     }
     if (!$vendor->codes->isEmpty()) {
         $vendor->codes()->delete();
     }
     $vendor->delete();
     return response(array('status' => 'success'), 200);
 }
Esempio n. 12
0
 public function destroy($id)
 {
     Vendor::find($id)->delete();
     $vendors = Vendor::orderBy('vendor')->paginate(env('VENDOR_PAGINATION_MAX'));
     return view('vendors.index')->with('vendors', $vendors);
 }
Esempio n. 13
0
 /** 
  * syncContacts
  *  - 
  * 
  * @return void
  */
 public function syncContacts()
 {
     $token_interface = new StdOAuth2Token($this->token);
     $google = OAuth::consumer('Google');
     $token = $google->getStorage()->storeAccessToken('Google', $token_interface);
     // get google service
     $googleService = OAuth::consumer('Google');
     // Send a request with it
     $response = $googleService->request('https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=500');
     $result = json_decode($response, true);
     // Going through the array to clear it and create a new clean array with only the email addresses
     $vendors = [];
     // initialize the new array
     foreach ($result['feed']['entry'] as $contact) {
         if (isset($contact['gd$email'])) {
             // Sometimes, a contact doesn't have email address
             $vendor = Vendor::firstOrNew(array('email' => $contact['gd$email'][0]['address']));
             $vendor->phone = isset($contact['gd$phoneNumber']) ? $contact['gd$phoneNumber'][0]['$t'] : '';
             $vendor->name = $contact['title']['$t'];
             $vendor->business = isset($contact['content']) ? $contact['content']['$t'] : '';
             $vendor->touch();
             array_push($vendors, $vendor);
         }
     }
     return $vendors;
 }
 public function getCounter($cell)
 {
     $vendor = new Vendor();
     $retval = $vendor->getCounter($cell);
     return $retval;
 }
 /**
  * Display the specified resource.
  *
  * @param Transaction $transaction
  * @param Account $accounts
  * @param Vendor $vendors
  * @param Category $categories
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show(Transaction $transaction, Account $accounts, Vendor $vendors, Category $categories, $id)
 {
     $transaction = $transaction->with(['category', 'vendor'])->where('id', '=', $id)->firstOrFail();
     $transaction->timestamp = str_replace(' ', 'T', $transaction->timestamp);
     if ($transaction->amount < 0) {
         $type = 'expense';
         $transaction->amount = $transaction->amount * -1;
     } elseif ($transaction->amount > 0) {
         $type = 'income';
     }
     return view('transactions.createOrShowOrUpdate', ['transaction' => $transaction, 'accounts' => $accounts->orderBy('name')->get(), 'vendors' => $vendors->orderBy('name')->get(), 'categories' => $categories->orderBy('name')->get(), 'type' => $type]);
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return Vendor::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
 /**
  * Download Vendors
  */
 public function downloadVendors()
 {
     $vendors = Vendor::with('codes')->orderBy('business', 'asc')->get();
     $filename = 'vendors-' . date('Y-m-d');
     $excel = Excel::create($filename, function ($excel) use($vendors) {
         $excel->sheet('veendors', function ($sheet) use($vendors) {
             $sheet->loadView('excel.vendors', ['vendors' => $vendors]);
         });
     })->export('csv');
 }