Skip to content

Commit d0c7acf

Browse files
committed
feature of clear cache, routes list
1 parent 8220604 commit d0c7acf

File tree

8 files changed

+262
-0
lines changed

8 files changed

+262
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
# laravel-tools
22
Laravel Development Tools
3+
https://github.com/RajTechnologiesPvtLtd/laravel-tools
4+
5+
## Installation on laravel
6+
1) In order to install Laravel Tools, just add the following to your composer. Then run `composer`:
7+
8+
```json
9+
composer rajtechnologies/laravel-tools
10+
```
11+
2) Open your `config/app.php` and add the following to the `providers` array:
12+
13+
```php
14+
RajTechnologies\Tools\ToolServiceProvider::class,
15+
```
16+
## Package Features
17+
18+
- Clear Cache
19+
- Routes List
20+
21+
## URL Routes
22+
23+
| Name | URL | Description |
24+
|-----------------|---------------------|---------------------------------|
25+
| Clear Cache | clear-cache | all type cache clear in larevel |
26+
| Routes List | routeslist | All Routes List |
27+
| API Routes List | routeslist?only=api | Only API Routes List |
28+
29+
## Contributing
30+
31+
- [Bhargav Raviya](https://github.com/bhargavraviya)
32+
33+
## Maintenance by Raj Technologies Pvt Ltd (For Laravel Starter Project)
34+
35+
- [Raj Technologies Pvt Ltd](http://www.rajtechnologies.com/contact-web-design-development-marketing-Ahmedabad-India-Gujarat.php).
36+
37+
## License
38+
39+
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "rajtechnologies/laravel-tools",
3+
"description": "All Type of Base Tools to Helping Development",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Bhargav Raviya",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"minimum-stability": "dev",
13+
"require": {}
14+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<!-- Required meta tags -->
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
8+
<!-- Bootstrap CSS 5 -->
9+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
10+
<!-- jquery Datatables CSS -->
11+
<link href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap5.min.css" rel="stylesheet">
12+
<!-- https://datatables.net/examples/styling/bootstrap5.html -->
13+
<style>
14+
a {
15+
text-decoration: unset;
16+
}
17+
</style>
18+
<title>@yield('title') | Raj Technologies Pvt Ltd</title>
19+
</head>
20+
<body>
21+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
22+
<div class="container-fluid">
23+
<a class="navbar-brand" href="#">Laravel Dev Tools</a>
24+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
25+
<span class="navbar-toggler-icon"></span>
26+
</button>
27+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
28+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
29+
<li class="nav-item">
30+
<a class="nav-link active" aria-current="page" href="#">Home</a>
31+
</li>
32+
33+
<li class="nav-item">
34+
<a class="nav-link" href="{{route('clearcache')}}">Clear Cache</a>
35+
</li>
36+
<li class="nav-item">
37+
<a class="nav-link" href="{{route('routeslist')}}">Routes List</a>
38+
</li>
39+
<li class="nav-item">
40+
<a class="nav-link" href="{{route('routeslist',['only'=>'api'])}}">API Routes List</a>
41+
</li>
42+
{{--<li class="nav-item dropdown">
43+
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
44+
Dropdown
45+
</a>
46+
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
47+
<li><a class="dropdown-item" href="#">Action</a></li>
48+
<li><a class="dropdown-item" href="#">Another action</a></li>
49+
<li><hr class="dropdown-divider"></li>
50+
<li><a class="dropdown-item" href="#">Something else here</a></li>
51+
</ul>
52+
</li>--}}
53+
54+
</ul>
55+
56+
</div>
57+
</div>
58+
</nav>
59+
<div class="container-fluid mt-2">
60+
@yield('content')
61+
</div>
62+
<footer class="fixed-bottom">
63+
<p class="text-center">
64+
<small>
65+
Laravel Tools by <a class="text-primary" href="http://rajtechnologies.com" target="_black">Raj Technologies Pvt Ltd</a>
66+
Created By <a class="text-success" href="http://bhargavraviya.medium.com" target="_black">Bhargav Raviya</a>
67+
</small>
68+
</p>
69+
</footer>
70+
<!-- Optional JavaScript; choose one of the two! -->
71+
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
72+
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
73+
<script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap5.min.js"></script>
74+
75+
76+
<!-- Option 1: Bootstrap Bundle with Popper -->
77+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
78+
79+
<!-- Option 2: Separate Popper and Bootstrap JS -->
80+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi" crossorigin="anonymous"></script>
81+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG" crossorigin="anonymous"></script>
82+
@yield('script-footer')
83+
<script>
84+
$(document).ready(function() {
85+
$('#datatable').DataTable();
86+
} );
87+
</script>
88+
</body>
89+
</html>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
@extends('Tool::layouts.app')
2+
@section('title', 'Web Routes List')
3+
@section('content')
4+
<div class="text-center">
5+
<h3>{{$title}}</h3>
6+
</div>
7+
8+
<table id="routetable" class="table table-striped table-bordered nowrap" style="width:100%">
9+
<thead>
10+
<tr>
11+
<th scope="col">HTTP Method</th>
12+
<th scope="col">Route</th>
13+
<th scope="col">Name</th>
14+
<th scope="col">Corresponding Action</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
@if(request()->has('only') == true)
19+
@foreach ($routeCollection->getIterator() as $data)
20+
@if (strpos($data->uri, 'api') !== false)
21+
<tr>
22+
<td>{{$data->methods()[0]}}</td>
23+
<td>{{$data->uri()}}</td>
24+
<td>{{$data->getName()}}</td>
25+
<td>{{$data->getActionName()}}</td>
26+
</tr>
27+
@endif
28+
@endforeach
29+
@else
30+
@foreach ($routeCollection as $data)
31+
<tr>
32+
<td>{{$data->methods()[0]}}</td>
33+
<td>{{$data->uri()}}</td>
34+
<td>{{$data->getName()}}</td>
35+
<td>{{$data->getActionName()}}</td>
36+
</tr>
37+
@endforeach
38+
@endif
39+
</tbody>
40+
</table>
41+
@endsection
42+
@section('script-footer')
43+
<script>
44+
$(document).ready(function() {
45+
$('#routetable').DataTable({
46+
"order": [[ 3, "desc" ]]
47+
});
48+
} );
49+
</script>
50+
@endsection

routes/web.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
Route::get('clear-cache', [RajTechnologies\Tools\Http\Controllers\RouteController::class, 'clearcache'])->name('clearcache');
3+
Route::get('routeslist', [RajTechnologies\Tools\Http\Controllers\RouteController::class, 'index'])->name('routeslist');
4+
?>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace RajTechnologies\Reminder\Http\Controllers;
4+
5+
use Illuminate\Foundation\Bus\DispatchesJobs;
6+
use Illuminate\Routing\Controller as BaseController;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
9+
10+
class Controller extends BaseController
11+
{
12+
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace RajTechnologies\Tools\Http\Controllers;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Http\Request;
7+
use RajTechnologies\Reminder\Repositories\WalkReminderRepository;
8+
use Illuminate\Support\Facades\Validator;
9+
use Route;
10+
use Artisan;
11+
class RouteController extends Controller
12+
{
13+
public function clearcache()
14+
{
15+
Artisan::call('cache:clear');
16+
Artisan::call('route:clear');
17+
Artisan::call('config:clear ');
18+
Artisan::call('view:clear ');
19+
return "Cache is cleared";
20+
}
21+
public function index(Request $request)
22+
{
23+
if(request()->has('only')){
24+
$title = "API Routes List";
25+
}else{
26+
$title = "All Routes List";
27+
}
28+
$routeCollection = Route::getRoutes();
29+
return view("Tool::routes.index",compact('title','routeCollection'));
30+
}
31+
32+
33+
}

src/ToolServiceProvider.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace RajTechnologies\Tools;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class ToolServiceProvider extends ServiceProvider
8+
{
9+
public function boot(){
10+
11+
//database/migrations
12+
//$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
13+
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
14+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'Tool');
15+
16+
}
17+
public function register(){
18+
19+
}
20+
}
21+
22+
?>

0 commit comments

Comments
 (0)