Laravel Factory Design Pattern ExampleIn your Laravel project, imagine you have objects that mostly have the same methods or features and you want to dynamically create those objects, Factory Design Pattern helps you with that. Laravel uses this pattern when calling methods such as `app('cache')->store('redis')` in driver-based components.
29 Feb 2020
Laravel API and Angular Client Tutorial – Part 6 Client Form File UploadIn this tutorial we will update the Angular Client app to and create a form to upload a file to our Laravel API. We will use the Angular reactive forms for validation. Lastly we will create an Angular guard to make the post form only accessible to logged-in users.
Laravel API and Angular Client Tutorial – Part 5 API File UploadIntroduction In this tutorial we will create an API route where we can upload a file with title. We will create service classes to reduce the codes in the controller and view-models to reduce the arguments. View-models are optional but is helpful with passing data around from controllers to other classes which I already covered … Read more
09 Feb 2020
Laravel API and Angular Client Tutorial – Part 4 Client Get Photos and VideosIntroduction In the last few parts, we had created the authentication API, get the photos and videos, and was able to have the Angular app login work. Now we can update the client app to show the photos or videos. In this tutorial we show the photos and videos in an infinite scrolling page. Lastly, … Read more
Laravel API and Angular Client Tutorial – Part 3 API Get Photos and VideosIntroduction In the last tutorials we added OAuth authentication in our Laravel API and had the Angular App login to it. Now we can create a resource URL where we can get the posts with photos and videos. We will format the response with the help of Dingo API’s helper trait and PHP Leagues Fractal … Read more
26 Jan 2020
cat: Angular 2+, API
Laravel API and Angular Client Tutorial – Part 2 Client OAuth LoginIn this tutorial we will create an Angular application that will authenticate to a Laravel OAuth server. We will use the authorization code with PKCE flow since the Angular application is an SPA or Single-page-application. In SPAs we can't store the client secret since it will be visible in the browser. So we are going to write the codes that will generate the correct login URL and redirect to it. After logging in to that URL the OAuth server will redirect back to our app where we can get an access token that we can use to request protected resources.
Laravel API and Angular Client Tutorial – Part 1 API AuthenticationThis tutorial will be the first part of multiple posts where we create an Angular SPA (Single Page Application) that uses a Laravel API. For this post we will work on setting up the project then adding authentication and authorization. We will be using Laravel's Passport together with Dingo API.
10 Jan 2020