public function fillServiceColumns()
 {
     $cafes = $this->cafe->all();
     foreach ($cafes as $cafe) {
         if (strpos($cafe->legacy_services, 'curbside')) {
             $cafe->curbside = 1;
         }
         if (strpos($cafe->legacy_services, 'icecream')) {
             $cafe->icecream = 1;
         }
         if (strpos($cafe->legacy_services, 'coffee')) {
             $cafe->coffee = 1;
         }
         if (strpos($cafe->legacy_services, 'frozenyogurt')) {
             $cafe->frozenyogurt = 1;
         }
         if (strpos($cafe->legacy_services, 'smoothies')) {
             $cafe->smoothies = 1;
         }
         if (strpos($cafe->legacy_services, 'wifi')) {
             $cafe->wifi = 1;
         }
         if (strpos($cafe->legacy_services, 'cookie')) {
             $cafe->cookie = 1;
         }
         if (strpos($cafe->legacy_services, 'savory')) {
             $cafe->savory = 1;
         }
         if (strpos($cafe->legacy_services, 'bakery')) {
             $cafe->bakery = 1;
         }
         $cafe->save();
     }
     return "cafes' services cleaned";
 }
示例#2
0
function cafeHasNoServices($id)
{
    $cafe = \App\Cafe::find($id);
    if ($cafe->bakery == 0 && $cafe->cookie == 0 && $cafe->curbside == 0 && $cafe->wifi == 0 && $cafe->smoothies == 0 && $cafe->frozenyogurt == 0 && $cafe->icecream == 0 && $cafe->savory == 0) {
        return '<small class="text-danger"><em>No Services Added</em></small>';
    }
    return false;
}
 public function listStoresByCity(Request $request)
 {
     $city = $request['city'];
     if ($request['online-order'] == 1) {
         return $this->cafe->where('archive', 0)->where('draft', 0)->where('city', $city)->where('online_order', '!=', '')->orderby('store_number', 'asc')->get();
     }
     return $this->cafe->where('archive', 0)->where('draft', 0)->where('city', $city)->orderby('store_number', 'asc')->get();
 }
 /**
  * @return string
  */
 public function sendContact(Request $request)
 {
     $rules = ['name' => 'required', 'email' => 'required', 'subject' => 'required', 'comments' => 'required'];
     $input = $request->all();
     $validation = Validator::make($input, $rules);
     if ($validation->passes()) {
         $location = null;
         if ($request['store']) {
             $location = $this->cafe->find($request['store']);
         }
         $message = ['name' => $request['name'], 'email' => $request['email'], 'subject' => $request['subject'], 'location' => $location, 'comments' => $request['comments']];
         Mail::send('emails.contact', $message, function ($m) use($message) {
             $m->from('*****@*****.**', 'Nestlecafe');
             //$m->to('*****@*****.**', 'Tarun Krishnan')->subject('A customer has submitted to the Nestlé® Toll House® Café By Chip Contact Form');
             $m->to('*****@*****.**', 'Nestlé Toll House Café By Chip')->subject('A customer has submitted to the Nestlé® Toll House® Café By Chip Contact Form');
         });
         return redirect('contact/success');
     }
     return back()->with('error', 'Please fill out all required fields');
 }
 public function phoneHelper()
 {
     $cafes = $this->cafe->all();
     $array = array();
     foreach ($cafes as $cafe) {
         if ($cafe->country == "USA" || strlen($cafe->phone) == 10) {
             if (strlen($cafe->phone) == 10) {
                 $origPhone = $cafe->phone;
                 $phone = preg_replace('/[^+.,0-9]/', '', $origPhone);
                 $phone = str_replace('+', '', $phone);
                 $phone = str_replace('.', '', $phone);
                 $phone = str_replace(',', '', $phone);
                 if (preg_match('/^(\\d{3})(\\d{3})(\\d{4})$/', $phone, $matches)) {
                     $result = '(' . $matches[1] . ') ' . $matches[2] . '-' . $matches[3];
                     $phone = $result;
                     $cafe->phone = $phone;
                 }
             }
             $cafe->save();
         }
     }
     return back()->with('success', 'Phone Numbers Formatted');
 }
 public function update(Request $request, $id)
 {
     $cafe = Cafe::find($id);
     $cafe->update($request->all());
     return response()->json($request->all());
 }
 public function getById($id)
 {
     return Cafe::findOrFail($id);
 }
示例#8
0
    \App\Cafe::where('state', 'SC')->update(['state' => 'South Carolina']);
    \App\Cafe::where('state', 'AZ')->update(['state' => 'Arizona']);
    \App\Cafe::where('state', 'CO')->update(['state' => 'Colarado']);
    \App\Cafe::where('state', 'LA')->update(['state' => 'Louisiana']);
    \App\Cafe::where('state', 'NV')->update(['state' => 'Nevada']);
    \App\Cafe::where('state', 'KS')->update(['state' => 'Kansas']);
    \App\Cafe::where('state', 'NM')->update(['state' => 'New Mexico']);
    \App\Cafe::where('state', 'AL')->update(['state' => 'Alabama']);
    \App\Cafe::where('state', 'OK')->update(['state' => 'Oklahoma']);
    \App\Cafe::where('state', 'WA')->update(['state' => 'Washington']);
    \App\Cafe::where('state', 'AR')->update(['state' => 'Arkansas']);
    \App\Cafe::where('state', 'MO')->update(['state' => 'Missouri']);
    \App\Cafe::where('state', 'MN')->update(['state' => 'Minnesota']);
    \App\Cafe::where('state', 'ON')->update(['state' => 'Ontario']);
    \App\Cafe::where('state', 'like', '%GA%')->update(['state' => 'Georgia']);
    \App\Cafe::whereNull('country')->update(['country' => 'United States of America']);
    return 'done';
});
//SANDBOX
Route::get('view-mailer', function () {
    return view('emails.contact');
});
//Snippets
Route::get('snippet/menu-items', 'SnippetController@outputMenuItems');
Route::get('snippet/clean-store-image-urls', 'SnippetController@cleanImageUrl');
Route::get('snippet/fill-cafe-services', 'SnippetController@fillServiceColumns');
//301s
Route::get('library/pdf/NutritionFactsGrid.pdf', function () {
    return redirect('uploads/documents/Nestle-Tollhouse-Cafe-by-Chip-Nutrition-Facts.pdf');
});
Route::get('{page}/{sub?}/{tert?}', 'RedirectController@index');