What are virtual columns? While developing any web application sometimes we need virtual columns - columns don't actually exist in our DB table, but we drive them from other columns. Why we need them? For example, generally, we use first_name and last_name in the users table. But sometimes we also need user's complete name i.e. full_name . There is no benefit of saving full_name in user table if we have already first_name and last_name in the table OR even if we have full_name as a column in our table then there is no benefit of saving first_name and last_name in the table. So in a scenario like this, we prefer to use the virtual column. Using Virtual Columns in Laravel Considering the first case, in Laravel to get virtual column i.e. full_name from the users table will have Accessors. Accessors are methods defined automatically called by Eloquent when select is called on that particular column. Let take an example here: To get full_...
Cookie in Laravel You can use the cookie in Laravel using the Helper method ` cookie() ` or method available with Request/Response Object or `Cookie` facade. $request->cookie('name'); OR use Illuminate\Support\Facades\Cookie; Cookie::get('name'); To get more clarity on how to use the cookie in Laravel with an example to show cookie consent popup on your Laravel website and hide/remove it once you accept the policy. Cookie Policy Consent Popup in Laravel First, create and a Cookie Consent popup as notification to the footer section of your Laravel main blade template file. <div class="cookies-block"> <h5>This website uses cookies</h5> <p>We use cookies to improve your experience and deliver personalised content. By using this website, you agree to our <a href="javascript:void()">Cookie Policy</a>.</p> ...
From last couple of days, I was doing R&D on how we can test file uploading API on CircleCi or Postman collection Run? Finally, I found a way to test the File uploading APIs using the Postman Desktop app OR Postman CLI collection run. I have also tested this solution, even on CircleCi for running the automated testing postman APIs by Postman CLI collection run. Here is step by step process, how you can test the file uploading API on CircleCi or Postman collection Run? Local Desktop App settings: Open and go to Local Postman app settings -> General Set working directly location ( default is postman installation directory but can also choose any other directory ) Place files (to use in file upload APIs during the collection run) in the working directory selected as in the above step and also in the root directory of your project. Now go to the API in which you need to upload a file, and select the file from the working directory selected in step 2. Save that ...
Comments
Post a Comment