Skip to content

Commit 28a10de

Browse files
committed
initial commit
0 parents  commit 28a10de

File tree

102 files changed

+15137
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+15137
-0
lines changed

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<p align="center">
2+
<img src="https://github.com/beyondscript/Laravel-Query-Builder-with-Vue-JS/blob/main/public/images/icons/favicon.webp" width="60" height="60" margin-left="auto" margin-right="auto" alt="Logo">
3+
<br>
4+
Laravel Query Builder with Vue JS
5+
</p>
6+
7+
## About Laravel Query Builder with Vue JS
8+
9+
Laravel Query Builder with Vue JS is a web application which was designed by using HTML, CSS, JavaScript and Vue JS and developed by using PHP and Laravel framework.
10+
11+
This website was built for learning Laravel Query Builder with Vue JS.
12+
13+
## How to use?
14+
15+
<strong>Step - 1:</strong>
16+
<br>
17+
Download or clone the repository
18+
19+
<strong>Step - 2:</strong>
20+
<br>
21+
Intall all the dependencies by running these commands "composer update" and "npm install"
22+
23+
<strong>Step - 3:</strong>
24+
<br>
25+
Copy the .env.example file from root directory to root directory then rename the copied file to .env
26+
27+
<strong>Step - 4:</strong>
28+
<br>
29+
Generate new application key by running the command "php artisan key:generate"
30+
31+
<strong>Step - 5:</strong>
32+
<br>
33+
Create a new database and import the laravelquerybuilderwithvuejs.sql file
34+
35+
<strong>Step - 6:</strong>
36+
<br>
37+
Add the database details in the .env file by editing the .env file like below:
38+
39+
DB_DATABASE=database_name
40+
<br>
41+
DB_USERNAME=database_user_name
42+
<br>
43+
DB_PASSWORD=database_user_password
44+
45+
<strong>Step - 7:</strong>
46+
<br>
47+
Add the application name in the .env file by editing the .env file like below:
48+
49+
APP_NAME="your_app_name"
50+
51+
<strong>Step - 8:</strong>
52+
<br>
53+
Add the application url in the .env file by editing the .env file like below
54+
55+
APP_URL=your_application_url
56+
57+
<strong>Step - 9:</strong>
58+
<br>
59+
Build the assets by running the command "npm run build"
60+
61+
<strong>Step - 10:</strong>
62+
<br>
63+
Delete the node_modules folder from the root directory
64+
65+
66+
## When a problem is found?
67+
68+
Do not hesitate to message me when you found any problem.
69+
<br>
70+
<a href="https://www.facebook.com/engrmdnafiulislam/">Facebook</a>
71+
<br>
72+
<a href="https://www.instagram.com/engrmdnafiulislam/">Instagram</a>

app/Console/Kernel.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* Define the application's command schedule.
12+
*
13+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
14+
* @return void
15+
*/
16+
protected function schedule(Schedule $schedule)
17+
{
18+
// $schedule->command('inspire')->hourly();
19+
}
20+
21+
/**
22+
* Register the commands for the application.
23+
*
24+
* @return void
25+
*/
26+
protected function commands()
27+
{
28+
$this->load(__DIR__.'/Commands');
29+
30+
require base_path('routes/console.php');
31+
}
32+
}

app/Exceptions/Handler.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of exception types with their corresponding custom log levels.
12+
*
13+
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
14+
*/
15+
protected $levels = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the exception types that are not reported.
21+
*
22+
* @var array<int, class-string<\Throwable>>
23+
*/
24+
protected $dontReport = [
25+
//
26+
];
27+
28+
/**
29+
* A list of the inputs that are never flashed to the session on validation exceptions.
30+
*
31+
* @var array<int, string>
32+
*/
33+
protected $dontFlash = [
34+
'current_password',
35+
'password',
36+
'password_confirmation',
37+
];
38+
39+
/**
40+
* Register the exception handling callbacks for the application.
41+
*
42+
* @return void
43+
*/
44+
public function register()
45+
{
46+
$this->reportable(function (Throwable $e) {
47+
//
48+
});
49+
}
50+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6+
use Illuminate\Foundation\Bus\DispatchesJobs;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Routing\Controller as BaseController;
9+
10+
class Controller extends BaseController
11+
{
12+
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
use Illuminate\Http\JsonResponse;
7+
use Illuminate\Http\Response;
8+
9+
class CsrfCookieController extends Controller
10+
{
11+
public function show(Request $request)
12+
{
13+
if ($request->expectsJson()) {
14+
return new JsonResponse(null, 204);
15+
}
16+
17+
return new Response('', 204);
18+
}
19+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
use DB;
8+
use Image;
9+
10+
class FirstTable extends Controller
11+
{
12+
public function store(Request $req){
13+
$validated = $req->validate([
14+
'image' => ['image']
15+
],
16+
[
17+
'image.image' => 'Image must be an image'
18+
]);
19+
20+
$data = array();
21+
$image = request()->file('image');
22+
if($image){
23+
$name = hexdec(uniqid());
24+
$fullname = $name.'.webp';
25+
$path = 'images/firsttable/';
26+
$url = $path.$fullname;
27+
$resize_image=Image::make($image->getRealPath());
28+
$resize_image->resize(300,300);
29+
$resize_image->save('images/firsttable/'.$fullname);
30+
$data['text'] = $req -> text;
31+
$data['number'] = $req -> number;
32+
$data['image'] = $url;
33+
DB::table('firsttable') -> insert($data);
34+
return response()->json([
35+
'message' => 'Data successfully added'
36+
],200);
37+
}
38+
else{
39+
$data['text'] = $req -> text;
40+
$data['number'] = $req -> number;
41+
DB::table('firsttable') -> insert($data);
42+
return response()->json([
43+
'message' => 'Data successfully added'
44+
],200);
45+
}
46+
}
47+
public function show(){
48+
$firsttables = DB::table('firsttable') -> orderBy('text', 'ASC') -> get();
49+
return $firsttables;
50+
}
51+
public function edit($id){
52+
$firsttable = DB::table('firsttable') -> where('id', $id)->first();
53+
return $firsttable;
54+
}
55+
public function update(Request $req){
56+
$validatedData = $req->validate([
57+
'image' => ['image']
58+
],
59+
[
60+
'image.image' => 'Image must be an image'
61+
]);
62+
63+
$data = array();
64+
$image = request()->file('image');
65+
if($image){
66+
$firsttable = DB::table('firsttable') -> where('id', $req->id)->first();
67+
$old_image=$firsttable->image;
68+
if(file_exists($old_image)){
69+
unlink($old_image);
70+
}
71+
$name = hexdec(uniqid());
72+
$fullname = $name.'.webp';
73+
$path = 'images/firsttable/';
74+
$url = $path.$fullname;
75+
$resize_image=Image::make($image->getRealPath());
76+
$resize_image->resize(300,300);
77+
$resize_image->save('images/firsttable/'.$fullname);
78+
$data['text'] = $req -> text;
79+
$data['number'] = $req -> number;
80+
$data['image'] = $url;
81+
DB::table('firsttable') -> where('id', $req->id)->update($data);
82+
return response()->json([
83+
'message' => 'Data successfully updated'
84+
],200);
85+
}
86+
else{
87+
$data['text'] = $req -> text;
88+
$data['number'] = $req -> number;
89+
DB::table('firsttable') -> where('id', $req->id)->update($data);
90+
return response()->json([
91+
'message' => 'Data successfully updated'
92+
],200);
93+
}
94+
}
95+
public function destroy(Request $req){
96+
$firsttable = DB::table('firsttable') -> where('id', $req->id)->first();
97+
$image = $firsttable->image;
98+
if(file_exists($image)){
99+
unlink($image);
100+
}
101+
DB::table('firsttable') -> where('id', $req->id)->delete();
102+
return response()->json([
103+
'message' => 'Data successfully deleted'
104+
],200);
105+
}
106+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
use DB;
8+
9+
class SecondTable extends Controller
10+
{
11+
public function store(Request $req){
12+
$data = array();
13+
$data['stext'] = $req -> stext;
14+
$data['ft_id'] = $req -> ft_id;
15+
DB::table('secondtable')->insert($data);
16+
return response()->json([
17+
'message' => 'Data successfully added'
18+
],200);
19+
}
20+
public function show(){
21+
$secondtables = DB::table('secondtable') -> orderBy('stext', 'ASC') -> join('firsttable', 'secondtable.ft_id', '=', 'firsttable.id') -> select('secondtable.*', 'firsttable.text') -> get();
22+
return $secondtables;
23+
}
24+
public function edit($id){
25+
$secondtable = DB::table('secondtable') -> join('firsttable', 'secondtable.ft_id', '=', 'firsttable.id') -> where('secondtable.id', $id) -> select('secondtable.*', 'firsttable.text') -> first();
26+
return $secondtable;
27+
}
28+
public function update(Request $req){
29+
$data = array();
30+
$data['stext'] = $req -> stext;
31+
$data['ft_id'] = $req -> ft_id;
32+
DB::table('secondtable') -> where('id', $req->id)->update($data);
33+
return response()->json([
34+
'message' => 'Data successfully updated'
35+
],200);
36+
}
37+
public function destroy(Request $req){
38+
DB::table('secondtable') -> where('id', $req->id)->delete();
39+
return response()->json([
40+
'message' => 'Data successfully deleted'
41+
],200);
42+
}
43+
}

0 commit comments

Comments
 (0)