Skip to content

Commit

Permalink
Update Github Actions OSs
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Villavicencio committed Jun 16, 2020
1 parent 701a97d commit 7438ddf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.platform }}
strategy:
max-parallel: 3
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
Expand All @@ -22,9 +27,7 @@ jobs:
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database-test.sqlite
run: touch database/database-test.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
Expand Down
9 changes: 3 additions & 6 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ pull_request_rules:
- name: automatic merge for Dependabot pull requests
conditions:
- author=dependabot-preview[bot]
- status-success=build (macos-latest, 10)
- status-success=build (macos-latest, 12)
- status-success=build (windows-latest, 10)
- status-success=build (windows-latest, 12)
- status-success=build (ubuntu-latest, 10)
- status-success=build (ubuntu-latest, 12)
- status-success=build (macos-latest)
- status-success=build (windows-latest)
- status-success=build (ubuntu-latest)
actions:
merge:
method: squash
2 changes: 1 addition & 1 deletion .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":880:{a:2:{s:7:"defects";a:7:{s:37:"ReservationControllerTest::testCreate";i:4;s:50:"ReservationControllerTest::testAcceptRejectConfirm";i:4;s:49:"ReservationControllerTest::testAcceptRejectReject";i:4;s:52:"ReservationControllerTest::testAcceptRejectNoPending";i:4;s:31:"UserControllerTest::testNewUser";i:4;s:53:"VacationPropertyControllerTest::testCreateNewProperty";i:4;s:48:"VacationPropertyControllerTest::testEditProperty";i:4;}s:5:"times";a:7:{s:37:"ReservationControllerTest::testCreate";d:0.098;s:50:"ReservationControllerTest::testAcceptRejectConfirm";d:0.002;s:49:"ReservationControllerTest::testAcceptRejectReject";d:0.002;s:52:"ReservationControllerTest::testAcceptRejectNoPending";d:0.002;s:31:"UserControllerTest::testNewUser";d:0.002;s:53:"VacationPropertyControllerTest::testCreateNewProperty";d:0.002;s:48:"VacationPropertyControllerTest::testEditProperty";d:0.002;}}}
C:37:"PHPUnit\Runner\DefaultTestResultCache":879:{a:2:{s:7:"defects";a:7:{s:37:"ReservationControllerTest::testCreate";i:4;s:50:"ReservationControllerTest::testAcceptRejectConfirm";i:4;s:49:"ReservationControllerTest::testAcceptRejectReject";i:4;s:52:"ReservationControllerTest::testAcceptRejectNoPending";i:4;s:31:"UserControllerTest::testNewUser";i:4;s:53:"VacationPropertyControllerTest::testCreateNewProperty";i:4;s:48:"VacationPropertyControllerTest::testEditProperty";i:1;}s:5:"times";a:7:{s:37:"ReservationControllerTest::testCreate";d:0.103;s:50:"ReservationControllerTest::testAcceptRejectConfirm";d:0.01;s:49:"ReservationControllerTest::testAcceptRejectReject";d:0.009;s:52:"ReservationControllerTest::testAcceptRejectNoPending";d:0.007;s:31:"UserControllerTest::testNewUser";d:0.066;s:53:"VacationPropertyControllerTest::testCreateNewProperty";d:0.008;s:48:"VacationPropertyControllerTest::testEditProperty";d:0.007;}}}
13 changes: 1 addition & 12 deletions app/Http/Controllers/ReservationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Reservation;
use App\User;
use App\VacationProperty;
use DB;
use Twilio\Rest\Client;
use Twilio\TwiML\MessagingResponse;

Expand Down Expand Up @@ -47,17 +46,7 @@ public function acceptReject(Request $request)
$hostNumber = $request->input('From');
$smsInput = strtolower($request->input('Body'));

$connection = config('database.default');
$driver = config("database.connections.{$connection}.driver");
if ($driver === 'sqlite') {
$concat_string = DB::raw("'+' || country_code || phone_number");
} else {
$concat_string = DB::raw("CONCAT('+',country_code::text, phone_number::text)");
}

$host = User::where($concat_string, 'LIKE', "%".$hostNumber."%")
->get()
->first();
$host = User::getUsersByFullNumber($hostNumber)->first();
$reservation = $host->pendingReservations()->first();

$smsResponse = null;
Expand Down
14 changes: 14 additions & 0 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use DB;

class User extends Model implements AuthenticatableContract,
AuthorizableContract,
Expand Down Expand Up @@ -64,4 +65,17 @@ public function fullNumber()
{
return '+' . $this->country_code . $this->phone_number;
}

public static function getUsersByFullNumber($number)
{
$connection = config('database.default');
$driver = config("database.connections.{$connection}.driver");
if ($driver === 'sqlite') {
$concat_string = DB::raw("'+' || country_code || phone_number");
} else {
$concat_string = DB::raw("CONCAT('+',country_code::text, phone_number::text)");
}

return self::where($concat_string, 'LIKE', "%".$number."%")->get();
}
}

0 comments on commit 7438ddf

Please sign in to comment.