When you’d need to update updated_at field of parent model, you can just use $touches of Laravel eloquent. Let’s assume, you have Posts and each Post has multiple Comments.Then it’s one to many relationship between Post and Comments.If a user added a comment for the post, we should update updated_at of the post as well.We …
How to use Laravel Task Scheduler on Windows 10
Creating and running Laravel’s scheduled tasks is pretty straightforward on Linux. All you have to do is to create a cronjob which looks something like * * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1 and it will call your Laravel command scheduler every minute to execute due tasks. However, Windows doesn’t have cron jobs. The closest equivalent to cron on Windows platform is Windows task …
Laravel Polymorphic Relationships
A polymorphic relationship allows the target model to belong to more than one type of model using a single association. One To One (Polymorphic) Table Structure A one-to-one polymorphic relation is similar to a simple one-to-one relation; however, the target model can belong to more than one type of model on a single association. For …
Laravel Spark
Spark is designed with only one goal in mind, to make scaffolding out a billing system for a SaaS app easy. If you’ve ever built out team management and a billing system then you already know how time-consuming and painful this process. Spark already integrated those functionalities and makes it easy to develop system.You can …
Ngrok for webhook testing.
When you develop your web applications, you will have situation to test 3rd party API integration in the local development environment. The tricky problem here is most of 3rd party APIs are callback based. In a word, most of 3rd party APIs send data/status as callbacks/webhook to original client. However when you wants to test …
Laravel logging
Laravel provides rich logging functionality. We can post messages to third party chatting platforms like slack using Laravel logging functionality. All of the configuration for your application’s logging system is housed in the config/logging.php configuration file. This file allows you to configure your application’s log channels, so be sure to review each of the available channels and …
Laravel Queue
Laravel queues provide a unified API across a variety of different queue backends, such as Beanstalk, Amazon SQS, Redis, or even a relational database. Queues allow you to defer the processing of a time consuming task, such as sending an email, until a later time. Deferring these time consuming tasks drastically speeds up web requests …
Laravel – Soft Deleting
In addition to actually removing records from your database, Eloquent can also “soft delete” models. When models are soft deleted, they are not actually removed from your database. Instead, a deleted_at attribute is set on the model and inserted into the database. If a model has a non-null deleted_at value, the model has been soft deleted. To enable soft …