file_put_contents(C:\xampp\htdocs\exam_system\storage\framework/sessions/FF): failed to open stream: No such file or directory => Soled this Error

Step 1: type your TERMINAL this Command

composer update

Step 2: type your TERMINAL this Command

php artisan r:clear

Step 3: type your TERMINAL this Command

php artisan v:clear

Step 4: type your TERMINAL this Command

php artisan c:Cache

Now is your Project is Running

Tagged : / / /

JavaScript Cheat Sheet — JSON, Loops, and Promises

JavaScript is one of the most popular programming languages for web programming.

In this article, we’ll look at the basic syntax of modern JavaScript

JSON

We can create JSON strings from JavaScript objects with the JSON.stringify method:

And we can convert JSON strings back to JavaScript objects with JSON.parse :

const obj = JSON.parse(json);

We can use it to store data in local storage.

We’ve to convert objects into strings first to store them.

To store objects we call localStorage.setItem :

The first argument is the key.

And we can get data by their keys with getItem :

localStorage.getItem(‘json’)

Loops

avaScript comes with various kinds of loops.

One kind of loop is the for loop:

for (let i = 0; i < 10; i++) { console.log(i); }

We can loop through any kind of iterable object with the for-of loop:

for (let i of custOrder) { console.log(i); }

Some iterable objects include arrays, strings, and node lists.

Another kind of loop is the while loop:

There’s also the do-while loop:

The break keyword lets us end the loop early:

The continue keyword lets us skip to the next iteration:

Data Types

JavaScript comes with various data types.

They include:

Objects

We can create an object with curly braces:

It has properties and methods.

this is the student object itself.

We can call fullName with student.fullName() .

And we can assign values to properties with:

student.age = 19;

Promises

We can create promises with the Promise constructor:

We can resolve to fulfill the promise with the sum.

And we call reject to reject the promise with an error.

Then we can call then to get the resolved value and catch to get the error values:

Conclusion

We can work with JSON, local storage, promises, and loops with JavaScript.

Tagged : / / /

CRUD Operations in Laravel using ajax

Step 1 – Install Laravel 5.8

First we want to Download Laravel 5.8 version for developing Crud application using Ajax. For this you have to open your terminal or command prompt and write below command. It will download Laravel 5.8 in your define directory.

composer create-project laravel/laravel=5.8 ajax-crud –prefer-dist

Step 2 – Laravel 5.8 Database Connection

Once Laravel 5.8 has been downloaded then after we have to make Database connection. For this first you have to open config/database.php and define Mysql Database configuration.

After this you have to open .env file and in that file also you have to define Mysql Database configuration, which you can find below.

Step 3 – Create Table

For Create Crud Application, first we have to create Mysql table. For create Mysql table from Laravel 5.8 application we have to write following artisan command in your command prompt.

php artisan make:migration create_ajax_cruds_table –create=ajax_cruds

Above command will command create migration file in database/migrations folder. In that file we have to define table column which you want to define in Mysql table. Below you can find source code of migration file.

Lastly for create Mysql table in your Database, you have to write following command in your terminal or command prompt. It will create ajax_cruds table in your define Database.

php artisan migrate

Step 4 – Create Model in Laravel 5.8

Now we want to make Model in Laravel 5.8, For this you have to write following command in your terminal or command prompt. It will create model file here app/AjaxCrud.php.

php artisan make:model AjaxCrud -m

Under this app/AjaxCrud.php file, you have to define table column for database operation which source code you can find below.

Step 5 – Create Blades Files

For display output data in browser, in Laravel 5.8 we have to create blade file in resources/views folder. Under this folder we have create ajax_index.blade.php file. In this file you can find HTML code and jQuery code for display data in jQuery Datatable.

Step 6 – Set Resource Route

Step 7 – Create Controller in Laravel 5.8

Lastly, We need to set resource route for ajax crud application. For this we have to open routes/web.php file.

Controller mostly used for handle HTTP request. Create new controller in Laravel 5.8 framework, we have to write following command.

php artisan make:controller AjaxCrudController –resource

This command will create AjaxCrudController.php file in app/Http/Controllers folder. In this controller file you can find all in build required method for do Crud operation. Under this controller for use AjaxCrud model, first we have to define use App\AjaxCrud; this statement at the header of the AjaxCrudController.php file.

index() – This is the root method of this controller. This method will received Ajax request for load data in jQuery DataTables plugin. If this method received ajax request then it will load data in jQuery DataTables plugin. In this ajax block you can find yajra datatables package code.

store() – For Insert Data into Mysql table using ajax in Laravel 5.8, here we have use store() method of AjaxCrudController.php. This method will received Ajax request for insert or add data. Under this method first it has validate for data. If there is any validation fails then it will send response to ajax request in JSON format. But there is no any validation fails then it will continue execution of code and first it will upload profile image of user and then after it will insert data into mysql table. And lastly it will send json response to ajax request.

edit() – This method is used for fetch single row of data from mysql table, and send data to ajax request in json formate which will be display under Bootstrap modal form.

update() – This method has received ajax request for update existing mysql table data. In this method first it check user has select profile image or not. If User is select image then in this method it will validate form data with selected file is image or not. But Suppose user has not select image then it will only validate textbox data only. If there is any validation error occur then it will send data to ajax request in json formate. After successfully validate form data then it will update data.

destroy() – For delete or remove mysql data, ajax request will be send to destroy() method. It will delete or remove mysql data in Laravel 5.8 by using ajax.

For run Laravel 5.8 application, you can write following command.

php artisan serve

For see Laravel 5.8 application in your browser, you have to write following url.

http://localhost:8000/ajax-crud
Tagged : / / / /

ERROR: Unable to store image in particular directory

today when i storing image then one error appears

Solution:I have given permission to that directory folder public folder after that my issue is resolved

chmod -R 777 ./public

refrence:https://stackoverflow.com/questions/34836602/laravel-uploading-file-unable-to-write-in-directory

Tagged : /

How to fix syntax error or access violation while use Group by

above error appear if you apply groupby in controller function is given below figure

Solution 1:In config/database.php at “mysql” change : ‘strict’ => true, to false

reference :https://stackoverflow.com/questions/49635699/laravel-distinct-on-join-results-not-working-in-query-builder

now Your bug resolved

Tagged : /

How to add multiple image using Laravel Microservice

Step 1: take input image name as array and write multiple in blade file

Step 2:store data using ajax

Step 3: set routing

Route::prefix(‘/touroperator’)->group(function () use ($namespace) {

$controller = $namespace.'\TourDashboardController';
$tourcontroller = $namespace.'\TourDetailController';

Route::post(‘addimage/{email}’, “$tourcontroller@addsimage”);

});

Step 4: In client side controller create function to get access token

take a variable as array and pass inside for loop and all the data pass inside for loop till no of image selected

Step 5: set env and app config file

ADD_MYHOLIDAYIMAGE_URL=/api/v1/j/addimagedetail

Step 6: Set routing in server side

Route::post(‘/addimagedetail’, ‘Admin\AdminTPController@storeimages’);

Step 7: apply bussiness query logic in server side controller

Finally our output looks like

Tagged : /

How to filter data using country,state and city dropdown in microservice

Step 1: create dropdown div block in blade file

Step 2: write jQuery key up and change function

Step 3:pass URL in ajax function for client side microservice

step 4: set routing

$tourcontroller = $namespace.’\TourDetailController’;
Route::get(‘toursdetail/{email}’,”$tourcontroller@gettrip”);

Step 5: write function in client side controller

Step 6: set env and app.php to connect between client and serverside for microservice

GET_MYHOLIDAYTRIP_URL=/api/v1/j/gettripdetail

Step 7: Set routing server side

Route::get(‘gettripdetail/{email}’, ‘Admin\AdminTPController@tripdetail’);

Step 8: create function in server side controller

now run finally project

Tagged : /

How to Store Data in Pop-Modal in Laravel

In this tutorial I’m going to describe how to store data in bootstrap 4 pop modal in laravel.

composer create-project laravel/laravel employee "5.8"

Step 2-> Go to .env and set up connect with database

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=popup-modal
DB_USERNAME=root
DB_PASSWORD=

3rd step migrate table

php artisan migrate

Next create migration table as name of employees lets go and create table

php artisan make:migration create_employees_table

Next got to database/migration/create_emoloyees_table and open this file

Simply copy and paste this code

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateEmployeesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('employees', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('fname');
$table->string('lname');
$table->string('email');
$table->string('address');
$table->string('mobile');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('employees');
}
}

Php artisan migrate

Next step create view files in resourses/views/
folder name

empmodel.blade.php

Go to empmodel.blade.php and paste below code

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Document</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>


{{-- model start here --}}

<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Employee Detail</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="{{ action('EmployeeController@store')}}" method="POST">
{{ csrf_field() }}
<div class="modal-body">

<div class="form-group">
<label>First Name</label>
<input type="text" name="fname" class="form-control" placeholder="Enter first name">
</div>

<div class="form-group">
<label>Last Name</label>
<input type="text" name="lname" class="form-control" placeholder="Enter last name">
</div>

<div class="form-group">
<label>Email</label>
<input type="text" name="email" class="form-control" placeholder="Enter email">
</div>

<div class="form-group">
<label>Address</label>
<input type="text" name="address" class="form-control" placeholder="Enter address">
</div>

<div class="form-group">
<label>Mobile</label>
<input type="text" name="mobile" class="form-control" placeholder="Enter mobile">
</div>

<button type="submit" class="btn btn-primary">Submit</button>

</div>
</form>
</div>
</div>
</div>
{{-- model end here --}}




<br><br><br>
<div class="container">
<h1>Store Data in Pop-modal in laravel</h1>

@if (count($errors) >0)
<div class="alert alert-danger">
<ul>
@foreach($errors->all() as $error)
<li>{{$error}}</li>
@endforeach

</ul>
</div>
@endif

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

</div>
@endif

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Add Employee
</button>
</div>

{{-- pop model start here --}}

<!-- Button trigger modal -->
{{-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button> --}}

<!-- Modal -->


{{-- pop model end here --}}
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>

Lets next go to create model

php artisan make:model Employee

Go to Employee model and paste below code

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Employee extends Model
{
//
}

Next create controller

php artisan make:controller EmployeeController -r

Go to EmployeeController and paste below code

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Employee;

class EmployeeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('empmodel');
}

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

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request,[
'fname' => 'required',
'lname' => 'required',
'email' => 'required',
'address' => 'required',
'mobile' => 'required',
]);

$emps = new Employee;

$emps->fname = $request->input('fname');
$emps->lname = $request->input('lname');
$emps->email = $request->input('email');
$emps->address = $request->input('address');
$emps->mobile = $request->input('mobile');

$emps->save();
return redirect('/employee')->with('success', 'Data saved');


}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

Next create route go to Route/web.php and paste below code

<?php

/*
|--------------------------------------------------------------------------
| 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('/employee','EmployeeController');

next go to browser and search

http://127.0.0.1:8000/employee

Now Form is look like this

Fill all the field and click on submit

Next Go to Localhost/phpmyadmin and check your data has been successfully saved

Thanks

How to fix fatal error: Maximum execution time of 300 seconds exceeded in XAMPP

Step1: Go to this path C:\xampp\phpMyAdmin\libraries

Step2: open file config.default.php

Step3: config.default.php on this line $cfg[‘ExecTimeLimit’] = 300; change

Step4: config.default.php on this line $cfg[‘ExecTimeLimit’] = 0; change

Step5: XAMPP Will be Restart and Import the Sql file.

Tagged : /