This file contains hidden or 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 | |
| // access route names as tenant.account.profile.* e.g. tenant.account.profile.edit | |
| // access route path as account/profile/* e.g. account/profile/edit | |
| Route::group(['prefix' => 'profile'], function () { | |
| Route::get('/', 'ProfileController@edit')->name('profile.edit'); // show profile edit form | |
| Route::patch('/', 'ProfileController@update')->name('profile.update'); // edit profile | |
| }); |
This file contains hidden or 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 | |
| dd( | |
| optional(App\User::find(2)->avatars)->path_avatar | |
| ); | |
This file contains hidden or 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 | |
| $user = App\User::find(2); | |
| return $user->avatars ? $user->avatars->path_avatar : ''; |
This file contains hidden or 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 | |
| // App/User | |
| public function avatars() | |
| { | |
| return $this->hasOne('App\Avatar'); | |
| } |
This file contains hidden or 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 | |
| $inItaly = collect($hosts) | |
| ->where('location', 'Italy') | |
| ->when(request('retired'), function($collection) { | |
| return $collection->reject(function($employee){ | |
| return $employee['is_active']; | |
| }); | |
| }); |
This file contains hidden or 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 | |
| $inItaly = collect($hosts)->where('location', 'Itaky'); | |
| if (request('retired')) { | |
| $inItaly = $inItaly->filter(function($employee){ | |
| return ! $employee['is_active']; | |
| }); | |
| } |
This file contains hidden or 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 | |
| $hosts = [ | |
| ['name' => 'Francesco Lettera', 'location' => 'Italy', 'is_active' => 0], | |
| ['name' => 'Mario Rossi', 'location' => 'Italy', 'is_active' => 0], | |
| ['name' => 'Giuseppe Giacobini', 'location' => 'Italy', 'is_active' => 1] | |
| ]; |
This file contains hidden or 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 | |
| @editor | |
| <a href="{{ route('super.secret') }}">Secret Page</a> | |
| @else | |
| Welcome Guest. <a href="{{ route('login') }}">Login</a> | |
| @endeditor |
This file contains hidden or 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 | |
| use Illuminate\Support\Facades\Blade; | |
| Blade::if('editor', function () { | |
| return auth()->check() && auth()->user()->isEditor(); | |
| }); |
This file contains hidden or 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 | |
| use Illuminate\Contracts\Validation\ImplicitRule; | |
| class MiaValidationRule implements ImplicitRule | |
| { | |
| public function passes($attribute, $value) | |
| { | |
| return $value > 10; | |
| } |
NewerOlder