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";
 }
Exemplo n.º 2
0
 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');
 }
Exemplo n.º 3
0
        Route::get('slides/{id}/archive', 'Admin\\SlideController@archive');
        Route::get('slides/archives', 'Admin\\SlideController@archived');
        Route::resource('slides', 'Admin\\SlideController');
        Route::get('cafes/format/phone-numbers', 'Admin\\CafeController@phoneHelper');
        Route::get('cafes/{id}/archive', 'Admin\\CafeController@archive');
        Route::get('cafes/geolocate', 'Admin\\CafeController@geolocate');
        Route::post('cafes/{id}/update-services', ['as' => 'cafe.update-services', 'uses' => 'Admin\\CafeController@updateServices']);
        Route::post('cafes/{id}/update-hours', ['as' => 'cafe.update-hours', 'uses' => 'Admin\\CafeController@updateHours']);
        Route::get('cafes/archives', 'Admin\\CafeController@archived');
        Route::resource('cafes', 'Admin\\CafeController');
        Route::get('/', 'Admin\\PagesController@index');
    });
});
//DEV FIXES
Route::get('fix-cafes', function () {
    $cafes = \App\Cafe::all();
    \App\Cafe::where('country', 'like', '%TX%')->update(['country' => 'United States']);
    \App\Cafe::where('country', 'like', '%FL%')->update(['country' => 'United States']);
    \App\Cafe::where('country', 'like', '%USA%')->update(['country' => 'United States of America']);
    \App\Cafe::where('country', 'like', '%Canada%')->update(['country' => 'Canada']);
    \App\Cafe::where('country', 'like', '%CANADA%')->update(['country' => 'Canada']);
    \App\Cafe::where('country', 'like', '%United States%')->update(['country' => 'United States of America']);
    \App\Cafe::where('country', 'like', '')->update(['country' => 'United States of America']);
    \App\Cafe::where('state', 'TX')->update(['state' => 'Texas']);
    \App\Cafe::where('state', 'CA')->update(['state' => 'California']);
    \App\Cafe::where('state', 'FL')->update(['state' => 'Florida']);
    \App\Cafe::where('state', 'MI')->update(['state' => 'Michigan']);
    \App\Cafe::where('state', 'NY')->update(['state' => 'New York']);
    \App\Cafe::where('state', 'IL')->update(['state' => 'Illinois']);
    \App\Cafe::where('state', 'AK')->update(['state' => 'Alaska']);
    \App\Cafe::where('state', 'MD')->update(['state' => 'Maryland']);