-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from limewell/1.x
1.x
- Loading branch information
Showing
7 changed files
with
161 additions
and
3 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
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
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
*/ | ||
return [ | ||
|
||
]; | ||
]; |
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,22 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| View Composers | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Particular bald files | ||
| App\Http\ViewComposers\MenuComposers::class => [ | ||
| 'welcome', | ||
| 'layout.main' | ||
| ] | ||
| | ||
| All bald files | ||
| App\Http\ViewComposers\MenuComposers::class => [ | ||
| '*' | ||
| ] | ||
| | ||
*/ | ||
|
||
return [ | ||
]; |
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,60 @@ | ||
<?php | ||
|
||
namespace Limewell\LaravelMakeExtender\Console\Commands; | ||
|
||
use Illuminate\Console\GeneratorCommand; | ||
use Illuminate\Contracts\Filesystem\FileNotFoundException; | ||
|
||
class MakeViewComposerCommand extends GeneratorCommand | ||
{ | ||
protected $name = 'make:composer'; | ||
|
||
protected $description = 'Create a new view composer'; | ||
|
||
protected $type = 'Composer'; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getStub(): string | ||
{ | ||
return $this->resolveStubPath('viewcomposer.stub'); | ||
} | ||
|
||
/** | ||
* Resolve the fully-qualified path to the stub. | ||
* | ||
* @param string $stub | ||
* @return string | ||
*/ | ||
protected function resolveStubPath(string $stub): string | ||
{ | ||
return file_exists($customPath = $this->laravel->basePath("stubs/vendor/laravel-make-extender/".$stub)) | ||
? $customPath | ||
: __DIR__. "/../../../stubs/".$stub; | ||
} | ||
|
||
/** | ||
* @param string $rootNamespace | ||
* @return string | ||
*/ | ||
protected function getDefaultNamespace($rootNamespace): string | ||
{ | ||
return $rootNamespace . '\ViewComposers'; | ||
} | ||
|
||
/** | ||
* @return bool | ||
* @throws FileNotFoundException | ||
*/ | ||
public function handle(): bool | ||
{ | ||
$handle = parent::handle(); | ||
|
||
if ($handle === false) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
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
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,25 @@ | ||
<?php | ||
|
||
namespace DummyNamespace; | ||
|
||
use Illuminate\View\View; | ||
|
||
class DummyClass | ||
{ | ||
public function __construct() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Bind data to the view. | ||
* | ||
* @param View $view | ||
* @return void | ||
*/ | ||
public function compose(View $view) | ||
{ | ||
$data = ['view','compose']; | ||
$view->with('data',$data); | ||
} | ||
} |