Posts
How to Implement Browser Push Notification in LaravelLaravel
![How to Implement Browser Push Notification in Laravel](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/151/how-to-implement-browser-push-notification-in-laravel.png)
How to Implement Browser Push Notification in LaravelLaravel
You can watch the following tutorial and you can continue reading this article.
Follow the Steps given here for setup push notification.
Step 1: You can quickly install Push via npm
npm install push.js --save
Step 2: Update webpack.mix.js
Add following code into webpack.mix.js
for copy and publish assets like js in the public directory. you can see the example here
mix.copy('node_modules/push.js/bin/push.min.js',
'public/assets/js/push.min.js');
I hope you know how to use laravel mix. you can watch this video tutorial if you want to know more about the laravel mix.
fire, npm run dev
command and publish js.
Step 3: Add assets in blade file
Add script before closing body tag.
<script src="{{ asset('assets/js/push.min.js') }}"></script>
Step 4: Add this code where you want to show a push
// add logo in public dir and use it here
const iconPath = '{{ asset('logo.PNG') }}
Push.create("Hello Shailesh!",{
body: "Welcome to the Dashboard.",
timeout: 5000,
icon: iconPath
});
SWOT Analysis - Strategic Planning- 2Human Resource
![SWOT Analysis - Strategic Planning- 2](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/149/swot-analysis---strategic-planning--2.png)
SWOT Analysis - Strategic Planning- 2Human Resource
In a previous blog we have discussed a few essential things about SWOT Analysis. Let's move further with How to do SWOT Analysis and How to use SWOT Analysis.
How to Do a SWOT Analysis
Before starting anything first draw up an Analysis Matrix. You can use a ready-made template. It’s a 2*2 grid, which represents four aspects of SWOT.
Specify your Objective why you are going to do SWOT Analysis Create a grid and divide it into four-part Label each box with a name for instance - Strength, Weakness, Opportunity, threat Add strength and weaknesses inappropriate part of the Matrix Gather the right people from different parts of your organization and make sure each will represent a specific department or team. Allow all to throw the ideas at the wall. After receiving ideas from your people, Organize ideas and then rank them. A voting system would be helpful to choose the best ideas. Based on the voting, prioritized list of ideas. The list is now up for discussion and debate.
The Helpful questions which inspire your Analysis
Strengths
It's the internal positive attributes of your company. The things are within your control. What do you do well? - the things which your company does well What unique resources can you draw on ?- Qualities that separate you from others in the market. What are the available skills? - Internal resources such as skills and available resources. What do others see as your strengths ?- Tangible assets such as intellectual property, capital proprietary technologies, etc.
Weaknesses
What could improve ?- Things your company lack Where do you have fewer resources than others?- Things your competitors do better than you What are others likely to see as weaknesses ?- Resources limitations
Opportunities
What opportunities are open to you ?- Uncleared market for specific products. What trends could you take advantage of ?- few competitors in your area. How can you turn strengths into opportunities ?- Emerging needs for your products and company
Threats
What threats could harm you ?- Emerging competitors in the market. What are your competitors doing ?- Changing regulatory environment. What threats do your weaknesses expose to you ?- changing Customers’ attitude towards your company Is your business in a poor location?
Conducting the SWOT Analysis in your organization it’s a powerful way to evaluate the company or project whether there are 5 people or 500 people.
![What is HTML <meta> Tag?](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/148/what-is-html-meta-tag.png)
This blog gives information and different elements of the meta tag.
A meta
is a type of HTML tag.
meta
is the only exit in HTML5. They are usually on the "head" of the page.
It provides search engines with information about a website page. Metadata will not be displayed on the page, but the machine is parsable.
The meta
element is used to specify page description, keywords, author, and other metadata.
HTML introduced a method to let web designers take control over the viewport (the user's visible area of a web page) through the meta
tag.
Note: Metadata is always passing as name/value pairs.
meta keywords
Define keywords for search engines
<meta name="keywords" content="HTML5 meta tag, meta tag important for SEO, meta description, meta keywords, meta author, meta title">
meta description
Define a description of your webpage.
Description Meta tags are coming up that contain web passage information. The description meta tag is the most important tag, your application will be ranked on your page by search engines. The description has relationships between 150 and 160 characters
<meta name="description" content="Meta tag provides search engines with information about a website page.">
Author Name
Author attribute specifies the author of the webpage.
<meta name="author" content="Payal Pansuriya">
http-equiv attribute
HTML meta refresh tag refreshes the page as you mention the time in the content.
<meta http-equiv="refresh" content="10">
Harmful Browser Security Threats: How to Avoid Them?Testing
![Harmful Browser Security Threats: How to Avoid Them?](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/147/harmful-browser-security-threats-how-to-avoid-them.png)
Harmful Browser Security Threats: How to Avoid Them?Testing
Web browser, is the most used application or portal for users to access the Internet. These browsers are very advanced, with improved usability and ubiquity. The individual is exposed to different internet browsers. Each of them consists of some perceived and real benefits. However, it is also true that none of them are safe from security threats. In fact, website browsers are more vulnerable to security vulnerabilities and when users interact with websites, they carry the possibilities of malware and other threats in them.
Mainly, 5 most common browser security threats and how to protect your system
With that in mind, here are some of the most common browser security threats and how to protect your system from them are follow below:
1. Removing Saved Login Credentials
Bookmarks associated with saved logins for linked sites is a terrible combination and doesn't really favor your system. When this is done, a hacker with little knowledge can hack it. There are some websites that use two-factor authentication, such as sending OTPs to your mobile phone to access them. However, many of them use this as a one-time access token so that a person can confirm his or her identity on the system they are intended to connect from. Deleting saved credentials is not good for your browser as well as for your system in general. Cybercriminals A can easily reset important identifiers and profiles on almost every website you visit. They can do this from anywhere and at any time. Once they have your IDs and passwords, they can run them from any system of their choice.
2. Permission to Browser History
Your browser's browsing history is a type of map or mechanism that keeps track of what you're doing and what sites you're visiting. It not only tells us which sites you visited, but for how long and when as well. If a criminal wants to get your credentials from the sites you access, they can do so easily, knowing which sites you have accessed through your browsing history.
3. Cookies
Cookies made up of locally stored files that identify association with certain files are another common browser security threat. Similar to browsing history, it can also track the site you visit and get credentials.
4. Browser Cache
Browser cache consists of storing sections of website pages which makes accessing and loading sites easier and faster, every time you visit. This can also identify the site or portal you have accessed and the content you have gone through. It also saves your location and device detection, making it a risky item as anyone can identify your location and device.
5. Autofill Information
Autofill information can pose a huge threat to your browser. Browsers like Chrome and Firefox store your address information, sometimes your profile information, and other personal information. But are you prepared if you fall into the wrong hands? Isn't it? Well, the criminal is now aware of and privacy to all your personal details.
In our next tutorial, will see Tips and Recommendations on How You Can Protect Yourself from These Threats.
What is a clip-path? And how to use CSS clip-path elements?CSS
![What is a clip-path? And how to use CSS clip-path elements?](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/145/what-is-a-clip-path-and-how-to-use-css-clip-path-elements.png)
What is a clip-path? And how to use CSS clip-path elements?CSS
In this blog, we will learn how to use clip-path and also cover inset(), polygon(), circle(), and ellipse() method .
What is CSS Clip-path?
Clip-path is a CSS property that creates a clipping field that sets which part of a component should be shown and which other parts are hidden. The inside of the clipped area is shown, while the outside is hidden.
CSS Property clip-path creates shapes by clipping an element. It clips some regions of an element to create new shapes. The most used method for clip-path is polygon(), circle(), and ellipse().
CSS clip-path() accepted values
These shapes can be created using basic shape functions. The basic shape functions are listed below:-
- inset()
- polygon()
- circle()
- ellipse()
inset()
The inset () function allows you to clip a component from around the coordinate system. The result is a visible rectangle. you can assign values to the margin or padding and border-radius property. but two values are limited in rounded corners. The first value is assigned to the top left corner and the bottom right corner and the second value is assigned to the top right corner and the bottom left corner.
polygon()
To design or clip the rectangular parts of the viewport, we use the polygon () method. Polygon is the most commonly used method in clip-path. We can construct any shape using the polygon method.
Example
circle()
The below image is created by using the clip-path method circle(50% at 50% 50%). In the circle(val1 at var2 var3), val1 is the size of the radius of the circle, and val2 and val3 are the positions of the center. val2 represents the position of the center from the left of the viewport, val2 represents the position of the center from the top of the viewport.
ellipse()
Below image is created using clip-path method ellipse(25% 40% at 50% 50%). An ellipse(val1 val2 at val3 val4) val1 and val2 are the horizontal and vertical distance from the center. val3 and val4 is the position of center.
Resources
I recommend you visit this link to play with the clip-path CSS property. You will see different types of shapes from this link. It's an imaginative place. You can customize your shape.
How to increase sales using Email Marketing?Sales
![How to increase sales using Email Marketing?](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/144/how-to-increase-sales-using-email-marketing.png)
How to increase sales using Email Marketing?Sales
Email marketing is an effective way to increase your sales. Email marketing is an easy way to sell your product without any charge with a high ROI.
People said the email marketing technique is not useful to sales. but it’s not real today in 2021 almost all people use email. So we can easily reach out to them and increase sales using email marketing.
First, know the term What is email marketing?
- Email marketing is an effective digital marketing strategy to send emails to customers related to product sales and increase sales using email marketing.
The importance of email marketing for increase sales
Email marketing is the two-way communication channel
- Email marketing is the two-way communication channel where people send a reply back to your mail easily so communication is faster and you can easily sell your product and increase sales using email marketing.
Your own email list
- In some social media, sometimes your account is banned with large community fans but email marketing is the only way to create your own email list so no one can ban you or nobody can take your leads away from you.
Email use for better conversion
-
Email marketing has a huge ROI(Return of Investment) of 4400%. No one social media has a huge ROI like email marketing. Do you think you can increase your sales using email marketing?
- Every person wants to increase sales using email marketing with high profit.
4 Ways to do email marketing and increase your sales
Built an email list
-
Build an email list of subscribers who are interested in what you are offering. The best way to create an email marketing list is to create a personal audience and send mail to them.
-
First, think of an email list. All the people are your customers and some of them are from different niches. They don’t like to receive from unrelated or different topics for a niche.
- So, build an email list of those who are interested in your product.
Maximize your email list
-
You know more people coming out to your website, offer the customer free templates, checklists, eBooks, etc.
- The most ideal approach to create drives that are really inspired by your item is by offering a lead magnet that tackles an issue for customers. For the most part, lead magnets are digital books, agendas, or exhaustive aides that your crowd can use to determine a problem area identified with your business.
Segment your lead list
-
Do not directly sell your product because nobody can purchase a product for you.
-
First, know the customer interest and send 4 to 5 emails or offer some on your product.
- After customers are convinced about your product then sell your product.
Ensure email is delivered or not
-
After sending an email, whether the email is delivered or not.
- Is the best way to increase sales using email marketing
5 Easy ways to create a Backlink for WebsiteSEO
![5 Easy ways to create a Backlink for Website](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/143/5-easy-ways-to-create-a-backlink-for-website.png)
5 Easy ways to create a Backlink for WebsiteSEO
Today I’m going to show you 5 easy ways to create a backlink for a website. If you do apply this method I'm sure to get a quality high-domain authorities website backlink.
At this time, all people want their website to rank 1st in google ranking.
If you want to rank your website in google 1st, create a backlink from a high authority site.
So let’s get started with 5 easy ways to create a backlink for a website.
1. Article Submission
What is article submission?
Article submission is the process to submit your article to high-quality websites or directories to improve SEO ranking and get traffic to websites.
Some free sites are available for submitting an article.
Article submission is one of the easy ways to create backlinks for a website.
Why Article submission important from a backlink point of view?
Article submission is an effective off-page SEO technique.
Using Article submission you can get quality backlinks from high domain authorities websites which use to get traffic to your website and improve SEO ranking.
How to submit an article to a free article submission site?
- Check article submission site DA & PA.
- Register on the article submission site.
- Choose the category of your article.
- Include your article or website link in the author’s description box. It’s the most important step.
- Submit your article
- Check if your article is published or not.
Here is some site to submit Free Article
-
Articlebiz
-
Articles Factory
-
Tumblr
-
Quora
- Apsense
2. Quora Answering
What is Quora Answering?
Quora answering is the site where users can ask questions related to their queries. And people can answer a user's query in quora.
What is the DA of quora?
- DA: 93
Why is Quora useful for backlinks?
People can answer user’s queries in quora. And put their website link or article post link.
It’s a type of backlink. When users click on that link they redirect to your site.
Quora is an easy way to create a backlink for your website.
Using Quora you can create a high-quality backlink.
Quora backlink is also affecting traffic to your website means increased traffic to your website and improve your SEO ranking using create a backlink from quora.
Guideline to create a backlink on quora
- Do not create a backlink
- First some answers to user’s queries
- The recommended way is to answer 5 user’s queries and create links to only a maximum of two of them.
- If you create all answers with your link then quora can ban you.
How to create a backlink from quora?
- Create an account on quora
- Answer user’s queries
- Create a link to your article.
- It’s a Nofollow backlink for your website.
All quora backlink is nofollow means It’s used to increase traffic for your website but google crawler can not read backlink because it’s nofollow.
3. Social Bookmarking
What is social bookmarking?
Social bookmarking is sites where a user submits their blog post, article, videos, etc.
Why use social bookmarking for SMM?
Social bookmarking sites where social media marketing managers find posts to their relevant topic. It’s Important to reach our posts through social media to more people and get traffic from them.
How to use a social bookmarking site to create backlinks?
- Create an account
- Submit your site
- Create a backlink
Here are some sites of social bookmarking
-
Reddit
-
Scoop it
-
Metafilter
-
Solo
- Bookmarktou
It’s an easy way to create a backlink for your website. In social bookmarking sites some backlinks are dofollow and some backlinks are nofollow.
4. Directory Submission
What is directory submission?
Directory submission where you can submit your site URL and details about your website to increase link building for your site.
A web directory is a kind of a website that has some categories, sub-categories. You can submit your site to a category of your niche.
Why is direct submission important for link building?
Using directory submission you can create high-quality backlinks from some high-domain authorities. It’s useful to get more traffic to your website and improve SEO ranking.
Types of Web Directory
- Paid and featured listing
- Regular link with reciprocal link
- Free and regular listing
How to use the Directory Submission site to create backlinks?
- Create an account
- Select a free and regular listing option
- Submit detail about your website
- Create backlinks
Here are some sites of social bookmarking
-
Somuch
-
Marketinginternetdirectory
-
Prolinkdirectory
-
Bedwan
- Livepopular
5. Ping Submission
Ping Submission is a mechanism of sending auto generated notifications to google spider.
It is one type of SEO tool. Where you can submit your blog post or website to get backlinks.
What are the benefits of Ping submission?
- Improve SEO ranking
- Useful for site indexing
- Easy ways to create backlinks
- Also, use for improving search engine result pages
How to get backlinks using ping submission?
- Create an account on the ping submission site
- Submit a blog post to the relevant category
- Get a backlink
- Not submit more than 3 same URLs on one ping submission site
Ping Submission Site
-
Pingomatic
-
Pingmylinks
-
Pingmyblog
-
Pingler
- Ping
Conclusion:
In this topic 5 easy ways to create a backlink for a website, if you read the whole blog post you have an answer on how to create backlinks. I hope your problem will be solved on this topic.
How to use laravel multi tenant (stancl/tenancy) with single DB ?Laravel
![How to use laravel multi tenant (stancl/tenancy) with single DB ?](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/142/how-to-use-multi-tenant-with-single-db.png)
How to use laravel multi tenant (stancl/tenancy) with single DB ?Laravel
Nowadays multi-tenant applications are more useful than single-tenant applications. We can use multi-tenant with multiple databases or single databases as per our need. But it's better to use a single DB with a multi-tenant when you have a small application.
In this tutorial, we are going to use multi-tenant with a single database.
We will implement multi-tenant with single DB by using the following package: https://github.com/archtechx/tenancy
Assuming you already have Laravel 8 repo setup. Now please follow the given steps to implement multi-tenancy with a single DB.
Package Installation
Run following commands :
-
composer require stancl/tenancy
-
php artisan tenancy:install
php artisan migrate
Add following service provider to config/app.php
App\Providers\TenancyServiceProvider::class
Create Custom Model
Now create modal named MultiTenant
into app\Models
MultiTenant.php
SavingTenant::class,
'saved' => TenantSaved::class,
'creating' => CreatingTenant::class,
// 'created' => TenantCreated::class,
'updating' => UpdatingTenant::class,
'updated' => TenantUpdated::class,
'deleting' => DeletingTenant::class,
'deleted' => TenantDeleted::class,
];
}
Update Tenancy Configuration
As we have added custom model we also need to define that model into config/tenancy.php
Please change tenant_model
value to our custom model.
'tenant_model' => \App\Models\MultiTenant::class,
Add Resolver
To use multi tenant with single DB we also need to add our customer resolver, that will be used into Middlewares that we will create ahead.
Create MultiTenantResolver
into app\Resolvers
App\Resolvers\MultiTenantResolver.php
find(Auth::user()->tenant_id)) {
return $tenant;
}
throw new TenantCouldNotBeIdentifiedByPathException($id);
}
public function getArgsForTenant(Tenant $tenant): array
{
return [
[$tenant->id],
];
}
}
Add Middleware
We will create our custom middleware that will set the current tenant into cache, and that will used by package to fire default query where('tenant_id', "tenant id we have set into middleware")
App\Http\Middleware\MultiTenantMiddleware.php
tenancy = $tenancy;
$this->resolver = $resolver;
}
/**
* Handle an incoming request.
*
* @param Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$tenant = Auth::user()->tenant_id;
return $this->initializeTenancy(
$request, $next, $tenant
);
}
}
Also, don't forget to add middleware alias into App\Http\kernel.php
protected $routeMiddleware = [
..............
'multi_tenant' => MultiTenantMiddleware::class,
];
Now we will apply this multi_tenant
middleware to our routes.
Add Trait to tenant-specific models
We have to add BelongsToTenant
trait to all of our tenant-specific models.
Say if we want to add tenant_id
into the users table then we must have to add BelongsToTenant
to the app\Models\User
model.
That trait will by default add following query everytime when we will try to fetch records or update records.
Where('tenant_id', 'tenant id will taken from cache')
Add tenant_id to tenant-specific migrations
As we have added the tenant trait, we must have to add tenant_id
into tenant-specific migrations as specified below.
public function up()
{
Schema::create('users', function (Blueprint $table) {
...........................
$table->string('tenant_id');
$table->foreign('tenant_id')
->references('id')
->on('tenants')
->onUpdate('cascade')
->onDelete('cascade');
$table->timestamps();
});
Update TenancyServiceProvider
Replace the App\Providers\TenactServiceProvider
by the following code.
[],
Events\TenantCreated::class => [
JobPipeline::make([
Jobs\CreateDatabase::class,
Jobs\MigrateDatabase::class,
// Jobs\SeedDatabase::class,
// Your own jobs to prepare the tenant.
// Provision API keys, create S3 buckets, anything you want!
])->send(function (Events\TenantCreated $event) {
return $event->tenant;
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
],
Events\SavingTenant::class => [],
Events\TenantSaved::class => [],
Events\UpdatingTenant::class => [],
Events\TenantUpdated::class => [],
Events\DeletingTenant::class => [],
Events\TenantDeleted::class => [
JobPipeline::make([
Jobs\DeleteDatabase::class,
])->send(function (Events\TenantDeleted $event) {
return $event->tenant;
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
],
// Domain events
Events\CreatingDomain::class => [],
Events\DomainCreated::class => [],
Events\SavingDomain::class => [],
Events\DomainSaved::class => [],
Events\UpdatingDomain::class => [],
Events\DomainUpdated::class => [],
Events\DeletingDomain::class => [],
Events\DomainDeleted::class => [],
// Database events
Events\DatabaseCreated::class => [],
Events\DatabaseMigrated::class => [],
Events\DatabaseSeeded::class => [],
Events\DatabaseRolledBack::class => [],
Events\DatabaseDeleted::class => [],
// Tenancy events
Events\InitializingTenancy::class => [],
Events\TenancyInitialized::class => [
// Listeners\BootstrapTenancy::class,
],
Events\EndingTenancy::class => [],
Events\TenancyEnded::class => [
Listeners\RevertToCentralContext::class,
],
Events\BootstrappingTenancy::class => [],
Events\TenancyBootstrapped::class => [],
Events\RevertingToCentralContext::class => [],
Events\RevertedToCentralContext::class => [],
// Resource syncing
Events\SyncedResourceSaved::class => [
Listeners\UpdateSyncedResource::class,
],
// Fired only when a synced resource is changed in a different DB than the origin DB (to avoid infinite loops)
Events\SyncedResourceChangedInForeignDatabase::class => [],
];
}
public function register()
{
//
}
public function boot()
{
$this->bootEvents();
// $this->mapRoutes();
$this->makeTenancyMiddlewareHighestPriority();
}
protected function bootEvents()
{
foreach ($this->events() as $event => $listeners) {
foreach (array_unique($listeners) as $listener) {
if ($listener instanceof JobPipeline) {
$listener = $listener->toListener();
}
Event::listen($event, $listener);
}
}
}
protected function mapRoutes()
{
if (file_exists(base_path('routes/tenant.php'))) {
Route::namespace(static::$controllerNamespace)
->group(base_path('routes/tenant.php'));
}
}
protected function makeTenancyMiddlewareHighestPriority()
{
$tenancyMiddleware = [
// Even higher priority than the initialization middleware
Middleware\PreventAccessFromCentralDomains::class,
Middleware\InitializeTenancyByDomain::class,
Middleware\InitializeTenancyBySubdomain::class,
Middleware\InitializeTenancyByDomainOrSubdomain::class,
Middleware\InitializeTenancyByPath::class,
Middleware\InitializeTenancyByRequestData::class,
];
foreach (array_reverse($tenancyMiddleware) as $middleware) {
$this->app[\Illuminate\Contracts\Http\Kernel::class]->prependToMiddlewarePriority($middleware);
}
}
}
Create / Fetch Tenant
Now we have to create a tenant and give that tenant_id to related users.
each user contains their specific tenant_id.
Use the following code to create a tenant :
$tenant1 = \App\Models\MultiTenant::create([
'name' => 'Tenant 1'
]);
$tenant2 = \App\Models\MultiTenant::create([
'name' => 'Tenant 2'
]);
That will create tenant into tenants
table and values will be stored into data
column as a son.
$tenant1 = App\Models\MultiTenant::where('data->name', 'Tenant 1')->first();
$tenant2 = App\Models\MultiTenant::where('data->name', 'Tenant 2')->first();
$tenant1User = User::where('id', 'user id here')->update(['tenant_id' => $tenant1->id]);
$tenant2User = User::where('id', 'user id here')->update(['tenant_id' => $tenant2->id]);
Now we have 2 tenants with 2 separate users who contain separate tenant ids.
Add Middleware to Routes
Now do login with User 1 and try to fetch all users from the database, it will return users of logged-in users' tenants only.
As we have the BelongToTenant
trait into the User
model.
Route::group(['middleware' => ['auth', 'multi_tenant']], function () { Route::get('users', function() {
// only tenant-1 users will be returned because we are setting the logged-in user tenant into the cache from `multi_tenant`middleware.
$allUsers = User::all();
});
});
You can use the same for other models too.
Hope this helps you.