mgsmus
Hayir, route:cache kibi komutlari hic calistirmadim.
Api.php icindeki Route'ler asagidaki kibi:
`Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('categories/custom1', 'Api\CategoryController@custom1');
Route::get('products/custom1', 'Api\ProductController@custom1');
Route::get('products/custom2', 'Api\ProductController@custom2');
Route::get('categories/report1', 'Api\CategoryController@report1');
Route::get('users/custom1', 'Api\UserController@custom1');
Route::get('products/custom3', 'Api\ProductController@custom3');
Route::get('products/listwithcategories', 'Api\ProductController@listwithcategories');
Route::apiResources([
'users' => 'Api\UserController',
'products' => 'Api\ProductController',
'categories' => 'Api\CategoryController'
]);`
Ve web.php icindeki Route'ler asagidaki kibi:
`Route::get('/secured', function (){
return "You are logged successfully!";
})->middleware('auth');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');`
Autehticate.php iceriyi de soyle:
`<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}`
200 status kodu aliyorum ama bir turlu /secured sayfasini acdikta /login'e yonlendirmiyor.