-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Laravel Package Development (START)
- Loading branch information
1 parent
7599e1a
commit b21f792
Showing
10 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "nabeeljavaid/package", | ||
"description": "Laravel Pacakge Boilerplate", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Nabeel Javaid", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Nabeeljavaid\\Package\\": "src/" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
return [ | ||
'author' => 'Nabeel Javaid', | ||
'default' => 'UTC' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
'greeting' => 'Hello to all of you!' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Laravel Package</title> | ||
|
||
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"> | ||
|
||
<style> | ||
html, body { | ||
height: 100%; | ||
} | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
display: table; | ||
font-weight: 100; | ||
font-family: 'Lato'; | ||
} | ||
.container { | ||
text-align: center; | ||
display: table-cell; | ||
vertical-align: middle; | ||
} | ||
.content { | ||
text-align: center; | ||
display: inline-block; | ||
} | ||
.title { | ||
font-size: 96px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="content"> | ||
<div class="title">{{ trans('package::messages.greeting') }}</div> | ||
<div class="title">Default Timezone: {{ config('package.default') }}</div> | ||
<div class="title">{{ $current_time }}</div> | ||
<p>{!! Timezones::saySomething() !!}</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Laravel Package</title> | ||
|
||
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"> | ||
|
||
<style> | ||
html, body { | ||
height: 100%; | ||
} | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
display: table; | ||
font-weight: 100; | ||
font-family: 'Lato'; | ||
} | ||
.container { | ||
text-align: center; | ||
display: table-cell; | ||
vertical-align: middle; | ||
} | ||
.content { | ||
text-align: center; | ||
display: inline-block; | ||
} | ||
.title { | ||
font-size: 96px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="content"> | ||
<div class="title">{{ trans('package::messages.greeting') }}</div> | ||
<div class="title">Default Timezone: {{ config('package.default') }}</div> | ||
<div class="title">{{ $current_time }}</div> | ||
<p>{!! Timezones::saySomething() !!}</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Nabeeljavaid\Package\Controllers; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Carbon\Carbon; | ||
|
||
class PackageController extends Controller | ||
{ | ||
|
||
public function index($timezone = NULL) | ||
{ | ||
$current_time = ($timezone) | ||
? Carbon::now(str_replace('-', '/', $timezone)) | ||
: Carbon::now(); | ||
return view('package::package.index', compact('current_time')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php namespace Nabeeljavaid\Timezones\Facade; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class Timezones extends Facade { | ||
|
||
protected static function getFacadeAccessor() { return 'Nabeeljavaid\Timezones\Timezones'; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php namespace Nabeeljavaid\Package; | ||
|
||
class Package { | ||
|
||
public static function saySomething() { | ||
return 'I am Facade'; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Nabeeljavaid\Package; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class PackageServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
// Load Routes | ||
$this->loadRoutesFrom(__DIR__ . '/routes.php'); | ||
|
||
// Load Language | ||
$this->loadTranslationsFrom( __DIR__ . '/../resources/lang', 'package'); | ||
|
||
// Load Views | ||
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'package'); | ||
|
||
// Publish Config | ||
$this->publishes([ | ||
__DIR__ . '/../config/package.php' => config_path('package.php'), | ||
], 'config'); | ||
|
||
// Publish Migrations | ||
$this->publishes([ | ||
__DIR__.'/../database/migrations/' => database_path('migrations') | ||
], 'migrations'); | ||
|
||
// Publish Resources | ||
$this->publishes([ | ||
__DIR__ . '/../resources/assets' => resource_path('assets/vendor/package'), | ||
__DIR__ . '/../resources/views' => resource_path('views/vendor/package'), | ||
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/package'), | ||
], 'resources'); | ||
|
||
|
||
} | ||
|
||
/** | ||
* Register the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// Config | ||
$this->mergeConfigFrom( __DIR__ . '/../config/package.php', 'package'); | ||
|
||
// Controllers | ||
$this->app->make('Nabeeljavaid\Package\Controllers\PackageController'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
Route::get('package/{timezone?}', 'Nabeeljavaid\Pacakge\Controllers\PackageController@index'); |