July 2018
Intermediate to advanced
420 pages
8h 46m
English
Now, we need to make some minor changes to our controllers in order to use the resource we just created. To avoid any mistakes, we will look at the code for all of our controllers:
<?phpnamespace App\Http\Controllers\API;use Illuminate\Http\Request;use App\Http\Controllers\Controller;use App\Bike;use Validator;use App\Http\Resources\BikesResource;class BikeController extends Controller{ /** * Protect update and delete methods, only for authenticated users. * * @return Unauthorized */ public function __construct() { $this->middleware('auth:api')->except(['index']); } /** * Display a listing ...