apiResource
есть смысл только для и то только если у тебя есть index, store, show, update, destroy (https://laravel.com/docs/8.x/controllers#actions-h...)Route::apiResource('staffs', StaffController::class);
__invoke
классRoute::get('staffs/{staff_id}/users', UserStaffController::class);
Route::get('users/{user_id}/staffs', StaffUserController::class);
/users?staff_id=1
и список отделов у которого есть пользователь /staffs?user_id=1
Route::apiResource('users', UserController::class);
Route::apiResource('staffs', StaffController::class);
@inject('metrics', 'App\Services\MetricsService')
<div>
Monthly Revenue: {{ $metrics->monthlyRevenue() }}.
</div>
public function __construct()
{
$this->middleware('auth');
$this->middleware(function ($request, $next) {
if(Gate::denies('VIEW_ADMIN')){
return redirect('myprofile');
}
return $next($request);
});
}
function name_should_not_be_too_long22()
{
$response = $this->post('/users', [
'name' => 'qwertgfdsazxcvbgtrewqasdfgbvcxzasdfgtrewqasdfgbvcxza',
'email' => 'ffffssff@yandex.ru',
'password' => 'secret',
]);
$response->assertSessionHasErrors([
'name' => 'The name may not be greater than 50 characters.'
]);
}
public function hasModel($relation)
{
return $this->$relation()->count()>0;
}
public function comments()
{
return $this->hasMany('App\Comment');
}
...
$this->hasModel('comments')
public function comments()
{
return $this->hasMany('App\Comment');
}
...
$this->has('comments')
public function testAccountAttach()
{
$response = $this->call('GET', route('accountattach',[
'id' => 1
]));
}
<input type="text" value="@if(true == true){{'Category Name'}}@endif" >
app/Providers/AdminServiceProvider.php
namespace App\Providers;
use Auth;
use Cartalyst\Sentinel\Sentinel;
use Illuminate\Support\ServiceProvider;
class AdminServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public
function boot()
{
Auth::provider('our_provider', function($app, array $config) {
return new Sentinel();
});
}
/**
* Register the application services.
*
* @return void
*/
public
function register()
{
//
}
}
app/config/auth.php
'providers' => [
'users' => [
'driver' => 'our_provider',
],
],
'locale'=>['uk','en','ru'],
'locale'=>'uk',