Skip to content

Commit 0e1fb5a

Browse files
committed
files struction, model, controllers, routes
1 parent 8a9a014 commit 0e1fb5a

File tree

9 files changed

+140
-0
lines changed

9 files changed

+140
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

composer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "kmlpandey77/laravel-redirection",
3+
"description": "This package design for redirect 404 page to new link",
4+
"authors": [
5+
{
6+
"name": "Kamal Pandey",
7+
"email": "kml.pandey77@gmail.com"
8+
}
9+
],
10+
"require": {},
11+
"autoload": {
12+
"psr-4": {
13+
"Kmlpandey77\\Redirection\\": "src/"
14+
}
15+
},
16+
"extra": {
17+
"laravel": {
18+
"providers": [
19+
"Kmlpandey77\\Redirection\\RedirectionServiceProvider"
20+
]
21+
}
22+
}
23+
}

config/config.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
return [
3+
'prefix' => 'admin',
4+
'middleware' => ['web', 'auth']
5+
];
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateRedirectionsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('redirections', function (Blueprint $table) {
17+
$table->id();
18+
$table->text('form_url');
19+
$table->text('to_url');
20+
$table->timestamps();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*
27+
* @return void
28+
*/
29+
public function down()
30+
{
31+
Schema::dropIfExists('redirections');
32+
}
33+
}

routes/web.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Route;
4+
5+
use Kmlpandey77\Redirection\Http\Controllers\RedirectionController;
6+
7+
Route::resource('redirection', 'RedirectionController');
8+

src/Facades/Redirection.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace Kmlpandey77\Redirection\Facades;
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class Redirection extends Facade
7+
{
8+
protected static function getFacadeAccessor()
9+
{
10+
return 'redirection';
11+
}
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Kmlpandey77\Redirection\Http\Controllers;
4+
use Illuminate\Routing\Controller;
5+
6+
class RedirectionController extends Controller{
7+
8+
}

src/Models/Redirection.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Kmlpandey77\Redirection\Model;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
8+
class Redirection extends Model
9+
{
10+
11+
}

src/RedirectionServiceProvider.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Lotusnp\Starter;
4+
5+
use Illuminate\Support\Facades\Route;
6+
use Illuminate\Support\ServiceProvider;
7+
8+
class RedirectionServiceProvider extends ServiceProvider{
9+
10+
public function boot()
11+
{
12+
$this->registerRoutes();
13+
}
14+
15+
// public function register()
16+
// {
17+
// $this->app->bind('redirection', function($app) {
18+
// return new Redirection();
19+
// });
20+
// }
21+
22+
23+
24+
protected function registerRoutes()
25+
{
26+
Route::group($this->routeConfiguration(), function () {
27+
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
28+
});
29+
}
30+
31+
protected function routeConfiguration()
32+
{
33+
return [
34+
'prefix' => config('redirection.prefix'),
35+
'middleware' => config('redirection.middleware'),
36+
];
37+
}
38+
39+
}

0 commit comments

Comments
 (0)