Complete Tutorial of Multidimensional Array

Multi-dimensional arrays are arrays that instead of storing a single element, store another array at each index. To put it another way, multi-dimensional arrays should be defined as an array of arrays. Every element in this array can be an array, and they can also have additional sub-arrays within them, as the name implies. Multiple dimensions can be used to access arrays or sub-arrays in multidimensional arrays.

Dimensions:– The number of indices required to pick an element is indicated by the dimensions of a multidimensional array. To pick an element from a two-dimensional array, use two indices.

Two dimensional array:– It’s the most basic type of multidimensional array. It may be made with the help of a nested array. The index of these arrays is always a number, and they can store any sort of element. The index starts at zero by default.

Syntax:-

array (
    array (elements...),
    array (elements...),
    ...
)

Example:

Output:-

Two dimensional associative array:– Al associative arrays are similar to indexed arrays, except that instead of linear storage (indexed storage), each value can be associated with a user-defined string key.

Multidimensional arrays in PHP - GeeksforGeeks

Example:

Output:

Display Marks: 
Array
(
    [Ankit] => Array
        (
            [C] => 95
            [DCO] => 85
            [FOL] => 74
        )

    [Ram] => Array
        (
            [C] => 78
            [DCO] => 98
            [FOL] => 46
        )

    [Anoop] => Array
        (
            [C] => 88
            [DCO] => 46
            [FOL] => 99
        )

)

Three Dimensional Array: It is a multidimensional array in its most basic form. Three-dimensional arrays have the same initialization as two-dimensional arrays. The distinction is that as the number of dimensions grows, so does the number of nested braces.

Syntax:

array (
    array (
        array (elements...),
        array (elements...),
        ...
    ),
    array (
        array (elements...),
        array (elements...),
        ...
    ),
    ...
)

Example:

Output:

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [1] => Array
                (
                    [0] => 3
                    [1] => 4
                )

        )

    [1] => Array
        (
            [0] => Array
                (
                    [0] => 5
                    [1] => 6
                )

            [1] => Array
                (
                    [0] => 7
                    [1] => 8
                )

        )

)

Accessing multidimensional array elements: In PHP, there are primarily two methods for accessing multidimensional array items.

  • Dimensions such as array name[‘first dimension’][‘second dimension’] can be used to retrieve elements.
  • The for loop can be used to access elements.
  • The for each loop may be used to access elements.

Example:

Output:

Tagged : / / / / / / /

How can I use math Object Properties in JavaScript?

Math

The Math object holds a set of constants and methods that enable more complex mathematical operations than the basic arithmetic operators. We can not instantiate a Math Object. The Math object is static so it‟s properties and methods are accessed directly.

Ex:-
Math.PI
Math.abs( )

Properties

  • E Returns Euler’s number (approx. 2.718)
  • LN2 Returns the natural logarithm of 2 (approx. 0.693)
  • LN10 Returns the natural logarithm of 10 (approx. 2.302)
  • LOG2E Returns the base-2 logarithm of E (approx. 1.442)
  • LOG10E Returns the base-10 logarithm of E (approx. 0.434)
  • PI Returns PI (approx. 3.14)
  • SQRT1_2 Returns the square root of 1/2 (approx. 0.707)
  • SQRT2 Returns the square root of 2 (approx. 1.414)

Methods

  • Math.abs(arg) Returns the absolute value of arg
  • Math.acos(arg) Returns the arccosine of arg, in radians
  • Math.acosh(arg) Returns the hyperbolic arccosine of arg
  • Math.asin(arg) Returns the arcsine of arg, in radians
  • Math.asinh(arg) Returns the hyperbolic arcsine of arg
  • Math.atan(arg) Returns the arctangent of arg as a numeric value between -PI/2 and PI/2 radians
  • Math.atan2(arg1, arg2) Returns the arctangent of the quotient of its arguments
  • Math.atanh(arg) Returns the hyperbolic arctangent of arg

Methods

  • Math.cbrt(arg) Returns the cubic root of arg
  • Math.ceil(arg) Returns arg, rounded upwards to the nearest integer
  • Math.cos(arg) Returns the cosine of arg (arg is in radians)
  • Math.cosh(arg) Returns the hyperbolic cosine of arg
  • Math.exp(arg) Returns the value of Ex
  • Math.floor(arg) Returns arg, rounded downwards to the nearest integer
  • Math.log(arg) Returns the natural logarithm (base E) of arg
  • Math.random() Returns a random number between 0 and 1
  • Math.round(arg) Rounds arg to the nearest integer

Methods

  • Math.max(arg1, arg2, …,arg_n) Returns the number with the highest value
  • Math.min(arg1, arg2, …,arg_n) Returns the number with the lowest value
  • Math.pow(arg1, arg2) Returns the value of arg to the power of arg2
  • Math.sin(arg) Returns the sine of arg (arg is in radians)
  • Math.sinh(arg) Returns the hyperbolic sine of arg
  • Math.sqrt(arg) Returns the square root of arg
  • Math.tan(arg) Returns the tangent of an angle
  • Math.tanh(arg) Returns the hyperbolic tangent of a number
  • Math.trunc(arg) Returns the integer part of a number (arg)

Tagged : / / /

Complete Tutorial of Associative Arrays

What is Associative Arrays?

Key value pairs are stored in associative arrays. For example, a numerically indexed array might not be the ideal choice for storing a student’s marks from several subjects in an array. Instead, we might use the names of the subjects as the keys in our associative array, with their appropriate marks as the value.

Example:-

Output:

Some Features of Associative Arrays?

Associative arrays are similar to numeric arrays in appearance, but differ in terms of index. An associative array’s index is a string that establishes a strong relationship between key and value.

For storing employee wages in an array, a numerically indexed array is not the ideal choice. Instead, you may create an associative list with the workers’ names as keys and their salary as the value.

  • The variable’s name is “$variable name…”, the element’s access index number is “[‘key name’],” and the array element’s value is “value.”
  • Consider the following scenario: you have a group of people and want to assign gender to each of them based on their names.
  • You may achieve this by using an associative list.
  • You can do so by using the code below.

Traversing the Associative Array:-

Loops may be used to go over associative arrays. The associative array can be looped through in two different ways. Using the for loop first, and then the foreach loop second.

Example:-

In this case, the array keys() function is used to identify indices with provided names, and the count() method is used to count the number of indices in associative arrays.

Output:-

Creating an associative array of mixed types:-

Output:-

Tagged : / / / / / / / / / / /

Global JavaScript Methods

Global JS Methods

JavaScript global methods can be used on all JavaScript data types.

  • Number ( )
  • parseFloat ( )
  • parseInt ( )

Number ( )

The Number() function converts the object argument to a number that
represents the object’s value.
If the value cannot be converted to a legal number, NaN is returned.
If the parameter is a Date object, the Number() function returns the number of
milliseconds since midnight January 1, 1970, UTC.

Ex: –

Number(true)
Number(“100”)
Number(100/“Hello”)

parseInt ( )

The parseInt() function parses a string and returns an integer.

Syntax:- parseInt(string, radix)

The radix parameter is used to specify which numeral system to be used, for example, a
the radix of 16 (hexadecimal) indicates that the number in the string should be parsed from
a hexadecimal number to a decimal number.

If the radix parameter is omitted, JavaScript assumes the following:

  • If the string begins with “0x”, the radix is 16 (hexadecimal)
  • If the string begins with any other value, the radix is 10 (decimal)

Only the first number in the string is returned.
Leading and trailing spaces are allowed.
If the first character cannot be converted to a number, parseInt() returns NaN.

parseInt ( )

parseFloat ( )

The parseFloat() function parses a string and returns a floating-point number. This function determines if the first character in the specified string is a number. If it is, it parses the string until it reaches the end of the number, and returns the number as a number, not as a string.

Syntax: – parseFloat(string)

  • Only the first number in the string is returned!
  • Leading and trailing spaces are allowed.
  • If the first character cannot be converted to a number, parseFloat() returns NaN.

parseFloat ( )

Tagged : / / / / /

What is GitLab? Why GitLab?

GitLab is one of the most used DevOps tools, a popular SCM tool among JVM devs. It was recognized as an IDC Innovator in Tools Supporting Open Developer Platforms in 2019 and owns two-thirds of the market share in the self-managed Git market. With more than 3,000 contributors, it’s one of the key competitors for GitHub.

GitLab Features:
Though similar in a lot of ways, GitLab differs from GitHub in the following areas:

Permits code collaborations within Teams
Doesn’t allow inner sourcing and lacks confidential issue features
Offers 100% built-in integration favoring their own CI tools.


GitLab Pricing


Both public and private repositories are available for free per user. GitLab’s Premium tier for teams is available at $19/user/month with code reviews, project management, and release controls. Ultimate packages for organizations with added security, planning, and compliance are available at $99/user/month.

GitLab also provides free Ultimate licenses, along with 50K CI minutes per month, to qualifying open source projects, educational institutions, and startups.

GitLab Security
GitLab has an internal security notification dashboard via Slack or email for high-priority security notifications appropriate for the entire organization.

It also offers a security department option for things like application development and security research as well as an on-call security engineer for relevant issues within the appropriate SLA.

GitLab Control
GitLab has a good design with source code browsing and is supported in Windows, Mac, Linux, Android, and iOS. It offers free private repositories, with different user access (permissions) based on their roles in the project. Audit management and CI/CD are better with the Auto DevOps feature. The community is smaller than GitHub’s.

When working on projects, it’s always easier to keep organized when you have everything in one place. This is especially true when working on such projects which require many different steps, or even more so when you work on multiple projects at once. In such scenarios, good organization is the key.

For developers, this is a very real and very common scenario. Bringing an application from an idea to a finished product takes a lot of complicated steps, and frequently includes many people or even different teams working on the same project.

Enter GitLab: an all-in-one solution that allows keeping all phases of your project in one place.

Since GitLab was developed as an expanded Git, we first need to explain what Git is.

So, what exactly is Git?
Git stands for an open-source control system, designed to handle everything from small to very large projects with speed and efficiency. The primary purpose of Git is to handle many changes in one or more projects which contain and so to track progress over time.
Git is created not only for professionals but also for non-technical users to monitor and track all their project files.

Why GitLab?
When we “expand” a Git to GitLab, we get the full-service repository and complete DevOps platform that allows all users to perform all the tasks in the project. By all tasks, we mean, every step as a part of every bigger phase or milestone, from project planning and source code management to monitoring and security. The main benefit of GitLab is to allow all team members to collaborate all the time through every phase and all to build better software and achieve the best possible results.

Why do DevOps supporters love GitLab?
Before this kind of platform, the developers’ work was to think ten steps ahead. Multitasking and “thinking five steps ahead” is often part of a developers work, but only when we speak about the code and application functionalities. However, we dont expect them to think also about the platform where the same application needs to come to life. Also, we often have more than one developer who works on the same project, so how can they track each other’s work? What if one, for some reason, needs to continue the colleague`s job? How should other developers identify the difficulties which the first one was facing and at what time? How will the automation tests for the code be written? Does anyone else need to run this code? How hard is it to reproduce the right environment to test it?

The GitLab platform answers this question with its simplicity and automation. GitLab application offers tracking from planning to creation, build, verify, security testing, deploying, and monitoring to automate the entire DevOps life cycle. We use it also for the high availability and replication and scalability and available for using on-premises or cloud storage together with wiki, issue-tracking, and CI/CD pipeline features.

We won’t be going too much into detail as we covered the DevOps topic fully in our “What is DevOps and why is it important” blog post, but in the meantime, we will continue with the listing of the main phases of the projects and try to explain how GitLab can support and assist us with it, with a combination of all kinds of toolsets.

How can GitLab assist us?
Each project consists of many or fewer milestones, while each of them contains small tasks that are needed to move the project from the idea to the completed phase. We mark off the ten main phases; most of them are essential for every project, but this list is a little bit adjusted to our field.

Git Commands Tutorials and Example: Git Reset – Git Revert

A committed snapshot can be undone with the git reverse command. Rather than removing the commit from the project history, it determines how to reverse the modifications made by the commit and adds a new commit with the resulting content. This prevents Git from losing history, which is critical for maintaining the integrity of your revision history and collaborating with confidence.

Reverting vs. Resetting:-

git revert

Use of Git Reset, Git Revert, Git Checkout & Squash Commit | by Ameet  Prajapati | MindOrks | Medium

It’s crucial to note that git revert just undoes a single commit; it doesn’t “revert” a project to its prior state by deleting all future commits. This is referred to as a reset rather than a revert in Git.

Compared to resetting, reverting offers two significant advantages. It is a “safe” action for commits that have already been published to a shared repository since it does not affect the project history. Please check the git reset page for further information on why changing shared history is harmful.

Second, although git reset can only go backwards from the current commit, git revert can target a specific commit at any time in the history. If you wanted to undo an old commit with git reset, for example, you’d have to erase all commits that came after the target commit, then remove the target commit and re-commit all subsequent commits. Needless to say, this isn’t a really elegant undo method.

git reset

git reset soft: When to Use Git Reset, Git Revert & Git Checkout - DEV  Community

If git revert is the “safe” approach to reverse changes, git reset may be considered the “dangerous” alternative. There is no way to recover the original copy when you undo with git reset (and the commits are no longer referenced by any ref or the reflog). When using this tool, be cautious because it’s one of the few Git commands that might cause you to lose your work.

What are Uses of:-

git reset:-

  • The selected file will be removed from the staging area, but the working directory will remain unaltered. This removes a file off the stage without overwriting any modifications.
  • The staging area should be reset to reflect the most recent commit, but the working directory should remain untouched. This upstages all files without overwriting any modifications, allowing you to re-create the staged snapshot from the ground up.
  • Back up the current branch tip to and reset the staging area to match, but don’t touch the working directory. Since then, all changes have been saved in the working directory, allowing you to re-commit the project history with cleaner, more atomic snapshots.

git reset –hard:-

  • To match the most current commit, reset the staging area and working directory. The –hard flag tells Git to overwrite all changes in the working directory, in addition to upstaging modifications. To put it another way, this deletes any uncommitted modifications, so make sure you truly want to get rid of your local changes before using it.
  • Reset both the staging area and the working directory to reflect the current branch tip’s position. This removes not just the uncommitted modifications, but also all subsequent commits.

Tagged : / / / / / / / /

How to use Number Methods in JavaScript?

Number Methods

  • toString ( )
  • toExponential ( )
  • toFixed ( )
  • toPrecision ( )
  • valueOf( )
  • isFinite( )
  • isInteger( )
  • isNan( )
  • isSafeInteger( )

toString( )

toString ( ) method returns a number as a string in other words it converts a number into a string. We can use this method to output numbers as hexadecimal (16), octal(8), binary(2).

Syntax: –
Variable_name.toString( );

toExponential ( )

The toExponential() method converts a number into an exponential notation.

Syntax:-
Variable_name.toExponential(y)
Where y is an integer between 0 and 20 representing the number of digits in the
notation after the decimal point. If omitted, it is set to as many digits as necessary to
represent the value.

Ex: –

toFixed ( )

The toFixed() method converts a number into a string, keeping a specified number of decimals also rounds the decimal. If the desired number of decimals is higher than the actual number, nulls are added to create the desired decimal length.

Syntax: –
a.toFixed(y)
Where y is the number of digits after the decimal point. Default is 0 (no digits after the decimal point)

Syntax: –
a.toFixed(y)
Where y is the number of digits after the decimal point. Default is 0 (no digits after the decimal point)

Ex:-

toPrecision ( )

The toPrecision() method formats a number to a specified length.
A decimal point and nulls are added (if needed), to create the specified length.

Syntax:-
Variable_name.toPrecision(y)
Where y is the number of digits. If omitted, it returns the entire number (without any
formatting)

Syntax:-
Variable_name.toPrecision(y)
Where y is the number of digits. If omitted, it returns the entire number (without any
formatting)

Ex:-

Number.isNaN()

The Number.isNaN() method determines whether a value is NaN (Not-A-Number).
This method returns true if the value is of the type Number, and equates to NaN. Otherwise, it returns false.
Number.isNaN() is different from the global isNaN() function. The global isNaN() function
converts the tested value to a Number, then tests it.
Number.isNaN() does not convert the values to a Number, and will not return true for any value
that is not of the type Number.

Number.isInteger( )

The Number.isInteger() method determines whether a value is an integer.
This method returns true if the value is of the type Number, and an integer, otherwise it
returns false.

Ex: –

Number.isSafeInteger()

The Number.isSafeInteger() method determines whether a value is a safe integer.
A safe integer is an integer that can be exactly all integers from (2^53 – 1) to -(2^53 – 1)
This method returns true if the value is of the type Number and a safe integer.
Otherwise, it returns false.

Tagged : / / /

In this tutorial I’m going to describe about crud operation how to install project and setup and create controller, models, migration and all the things please read it carefully and follow some easy steps.

Lets go to download project and set up to

composer create-project laravel/laravel form "5.8.*"

Next go to .env file and put your database name -> form

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=form
DB_USERNAME=root
DB_PASSWORD=

Next step create database in PhpMyAdmin Database name 👇

form

Now migrate the table run this command 👇

php artisan migrate

Table has been migrated successfully.

let’s go to create model, migration and controller in one command copy below code and paste in your terminal.

php artisan make:model product -mcr

Now migrate the table

php artisan migrate

Step 4: Add Resource Route

<?php

use App\Http\Controllers\ProductController;


/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
return view('welcome');
});


// Route::resource('products', ProductController::class);

Route::resource('products', ProductController::class);

Step 5: Go to Your Controller and paste below code in your controller file

<?php

namespace App\Http\Controllers;

use App\Product;
use Illuminate\Http\Request;

class ProductController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$products = Product::latest()->paginate(5);

return view('products.index',compact('products'))
->with('i', (request()->input('page', 1) - 1) * 5);
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('products.create');
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required',
'detail' => 'required',
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);

$input = $request->all();

if ($image = $request->file('image')) {
$destinationPath = 'image/';
$profileImage = date('YmdHis') . "." . $image->getClientOriginalExtension();
$image->move($destinationPath, $profileImage);
$input['image'] = "$profileImage";
}

Product::create($input);

return redirect()->route('products.index')
->with('success','Product created successfully.');
}

/**
* Display the specified resource.
*
* @param \App\Product $product
* @return \Illuminate\Http\Response
*/
public function show(Product $product)
{
return view('products.show',compact('product'));
}

/**
* Show the form for editing the specified resource.
*
* @param \App\Product $product
* @return \Illuminate\Http\Response
*/
public function edit(Product $product)
{
return view('products.edit',compact('product'));
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Product $product
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Product $product)
{
$request->validate([
'name' => 'required',
'detail' => 'required'
]);

$input = $request->all();

if ($image = $request->file('image')) {
$destinationPath = 'image/';
$profileImage = date('YmdHis') . "." . $image->getClientOriginalExtension();
$image->move($destinationPath, $profileImage);
$input['image'] = "$profileImage";
}else{
unset($input['image']);
}

$product->update($input);

return redirect()->route('products.index')
->with('success','Product updated successfully');
}

/**
* Remove the specified resource from storage.
*
* @param \App\Product $product
* @return \Illuminate\Http\Response
*/
public function destroy(Product $product)
{
$product->delete();

return redirect()->route('products.index')
->with('success','Product deleted successfully');
}
}

Next go to model and paste in below code

app/Models/Product.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class product extends Model
{
protected $fillable = [
'name','detail','image'
];
}

Step 6: Add Blade Files

1) layout.blade.php

2) index.blade.php

3) create.blade.php

4) edit.blade.php

5) show.blade.php

resources/views/products/layout.blade.php

<!DOCTYPE html>
<html>
<head>
<title>Laravel Crud Operation laravel amit</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet">
</head>
<body>

<div class="container">
@yield('content')
</div>

</body>
</html>

resources/views/products/index.blade.php

@extends('products.layout')

@section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Laravel Crud Operation with Image store Laravel Amit</h2>
</div>
<div class="pull-right">
<a class="btn btn-success" href="{{ route('products.create') }}"> Create New Product</a>
</div>
</div>
</div>

@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif

<table class="table table-bordered">
<tr>
<th>No</th>
<th>Image</th>
<th>Name</th>
<th>Details</th>
<th width="280px">Action</th>
</tr>
@foreach ($products as $product)
<tr>
<td>{{ ++$i }}</td>
<td><img src="/image/{{ $product->image }}" width="100px"></td>
<td>{{ $product->name }}</td>
<td>{{ $product->detail }}</td>
<td>
<form action="{{ route('products.destroy',$product->id) }}" method="POST">

<a class="btn btn-info" href="{{ route('products.show',$product->id) }}">Show</a>

<a class="btn btn-primary" href="{{ route('products.edit',$product->id) }}">Edit</a>

@csrf
@method('DELETE')

<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</table>

{!! $products->links() !!}

@endsection

resources/views/products/create.blade.php

@extends('products.layout')

@section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Add New Product</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('products.index') }}"> Back</a>
</div>
</div>
</div>

@if ($errors->any())
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif

<form action="{{ route('products.store') }}" method="POST" enctype="multipart/form-data">
@csrf

<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Name:</strong>
<input type="text" name="name" class="form-control" placeholder="Name">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Detail:</strong>
<textarea class="form-control" style="height:150px" name="detail" placeholder="Detail"></textarea>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Image:</strong>
<input type="file" name="image" class="form-control" placeholder="image">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 text-center">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>

</form>
@endsection

resources/views/products/edit.blade.php

@extends('products.layout')

@section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Edit Product</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('products.index') }}"> Back</a>
</div>
</div>
</div>

@if ($errors->any())
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif

<form action="{{ route('products.update',$product->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')

<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Name:</strong>
<input type="text" name="name" value="{{ $product->name }}" class="form-control" placeholder="Name">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Detail:</strong>
<textarea class="form-control" style="height:150px" name="detail" placeholder="Detail">{{ $product->detail }}</textarea>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Image:</strong>
<input type="file" name="image" class="form-control" placeholder="image">
<img src="/image/{{ $product->image }}" width="300px">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 text-center">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>

</form>
@endsection

resources/views/products/show.blade.php

@extends('products.layout')

@section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2> Show Product</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('products.index') }}"> Back</a>
</div>
</div>
</div>

<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Name:</strong>
{{ $product->name }}
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Details:</strong>
{{ $product->detail }}
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Image:</strong>
<img src="/image/{{ $product->image }}" width="500px">
</div>
</div>
</div>
@endsection

Now php artisan serve

http://localhost:8000/products

Now its open look like this 👇

Thanks 🙏🙏

How to work Number type in JavaScript

Numbers

Number type in JavaScript includes both integer and floating-point values. JavaScript numbers are always stored as double-precision floating-point numbers, following the international IEEE 754 standard.

JavaScript also provides an object representation of numbers.

Ex:-

12
23.45
5e3

Numbers

Primitive

Constructor

Accessing Number

Number with String

NaN

The NaN property represents the “Not-a-Number” value. This property indicates that a value is not a legal number. NaN never compares equal to anything, even itself.
The NaN property is the same as the Number. Nan property.

Global isNaN ( ) Method

The isNaN() function is used to determines whether a value is an illegal number (Not-a-Number).
This function returns true if the value equates to NaN. Otherwise, it returns false.
This function is different from the Number specific Number.isNaN() method.
The global isNaN() function, converts the tested value to a Number, then tests it.

Syntax: – isNaN(value)

Infinity and – Infinity

Infinity or -Infinity is the value JavaScript will return if a number is too large or too small. All Infinity values compare equal to each other.

Ex:-
document.write(5 / 0); // infinity
document.write(- 5 / 0); // – infinity

Tagged : / / / / /

How many data types How to work are there in JavaScript?

Boolean

Boolean is the built-in object corresponding to the primitive Boolean data type. JavaScript boolean can have one of two values: true or false.

Primitive Values
var primitiveTrue = true;
var primitiveFalse = false;

Boolean Function
var functionTrue = Boolean(true);
var functionFalse = Boolean(flase);

Boolean Constructor
var constructorTrue = new Boolean(true);
var constructorFalse = new Boolean(false);

Boolean

If value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (“”), the object has an initial value of false.

String

A string is a built-in object corresponding to the primitive string data type.
A string is a group of characters.

String

Primitive
var str = “Hello DevopsSchool”;——————————
var str = „Hello DevopsSchool‟; ——————————String
var str = Hello DevopsSchool;—————————–

Constructor
var str = new String (“Hello DevopsSchool”);——————————
var str = new String („Hello DevopsSchool‟); —————————– Object
var str = new String (Hello DevopsSchool);—————————–

Accessing String

Access String

String Concatenation

Concat Operator

Template Literal/ Template Strings

Template literals are string literals allowing embedded expressions. You can
use multi-line strings and string interpolation features with them.
Template literals are enclosed by the back-tick () character instead of double
or single quotes.

Multiple Line String

String Interpolation

Template literals can contain placeholders. These are indicated by the dollar sign and curly braces
(${expression})

String Methods

  • charAt ( )
  • charCodeAt( )
  • toUpperCase( )
  • toLowerCase ( )
  • Trim( )
  • Replace ( )
  • Split ( )
  • indexOf( )
  • Search ( )
  • Slice ( )
  • Substring( )
  • Substr ()
Tagged : / / / /