User::query()->create($request->all());
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function replicateWithRelations(QuestionCategory $questioncategory) | |
{ | |
$newCategory = $questioncategory->replicate(); | |
$newCategory->name = "Kopyası: ".$questioncategory->name; | |
$newCategory->push(); | |
$questioncategory->relations = []; | |
//load relations on EXISTING MODEL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Laravel | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
laravel-tests: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests (PHP) | |
on: [push] | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_script: | |
- echo 'Before script' | |
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' | |
- eval $(ssh-agent -s) | |
- mkdir -p ~/.ssh | |
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - | |
- chmod 700 ~/.ssh | |
- ssh-keyscan -H 'domain.com' >> ~/.ssh/known_hosts | |
- chmod 644 ~/.ssh/known_hosts | |
building: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use Illuminate\Http\Resources\Json\ResourceCollection; | |
use Illuminate\Pagination\UrlWindow; | |
use Illuminate\Support\Arr; | |
use Barryvdh\Debugbar\Facade as DebugbarFacade; | |
use Illuminate\Container\Container; | |
use Illuminate\Contracts\Pagination\LengthAwarePaginator as LengthAwarePaginatorContract; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('/', function (\Illuminate\Http\Request $request) { | |
$initialSearch = $request->query('search', ''); | |
$userQuery = User::query() | |
->when($request->filled('search'),function($query) use ($initialSearch){ | |
$query->where('name','LIKE','%'.$initialSearch.'%') | |
->orWhere('email','LIKE','%'.$initialSearch.'%'); | |
}); |