-
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.
added facades, removed laracasts/formvalidator
- Loading branch information
Showing
22 changed files
with
321 additions
and
47 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
composer.phar | ||
composer.lock | ||
.DS_Store | ||
.idea |
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
24 changes: 4 additions & 20 deletions
24
src/Slider23/LaravelModulator/templates/default/Controllers/ModulenameController.txt
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 |
---|---|---|
@@ -1,33 +1,17 @@ | ||
<?php namespace {{namespace}}\Controllers; | ||
|
||
use {{namespace}}\Forms\{{Modulename}}Form; | ||
use Laracasts\Validation\FormValidationException; | ||
use BaseController; | ||
|
||
class {{Modulename}}Controller extends \BaseController { | ||
class {{Modulename}}Controller extends BaseController { | ||
|
||
private ${{modulename}}Form; | ||
|
||
public function __construct({{Modulename}}Form ${{modulename}}Form) | ||
public function __construct() | ||
{ | ||
$this->{{modulename}}Form = ${{modulename}}Form; | ||
|
||
} | ||
|
||
public function getExample() | ||
{ | ||
return \View::make("{{modulename}}/example"); | ||
} | ||
|
||
public function postExample() | ||
{ | ||
$input = \Input::only('field1', 'field2'); | ||
try{ | ||
$this->{{modulename}}Form->valdate($input); | ||
} | ||
catch (FormValidationException $e) | ||
{ | ||
return \Redirect::back()->withInput()->withErrors($e->getErrors()); | ||
} | ||
|
||
return \Redirect::back()->withSuccess(true); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Slider23/LaravelModulator/templates/default/Facades/Modulename.txt
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,11 @@ | ||
<?php namespace {{namespace}}\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class {{Modulename}} extends Facade{ | ||
|
||
protected static function getFacadeAccessor() | ||
{ | ||
return "{{modulename}}facade"; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Slider23/LaravelModulator/templates/default/Facades/ModulenameFacadeClass.txt
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,15 @@ | ||
<?php namespace {{namespace}}\Facades; | ||
|
||
class {{Modulename}}FacadeClass { | ||
|
||
public function __construct() | ||
{ | ||
|
||
} | ||
|
||
public function example() | ||
{ | ||
return "This is string from facade class"; | ||
} | ||
|
||
} |
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
14 changes: 1 addition & 13 deletions
14
src/Slider23/LaravelModulator/templates/default/Views/modulename/example.txt
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 |
---|---|---|
@@ -1,17 +1,5 @@ | ||
This is example view for module {{Modulename}}.<br> | ||
Created by laravel-modulator.<br> | ||
<br> | ||
<h4>Example for form validation</h4> | ||
<form action="" method="POST"> | ||
|
||
Field1: <?php echo Form::text('field1', Input::old('field1')); ?><br> | ||
<?php if($errors->first('field1')) echo '<span style="color:red">'.$errors->first('field1').'</span>'; ?> | ||
|
||
Field2: <?php echo Form::text('field2', Input::old('field2')); ?><br> | ||
<?php if($errors->first('field2')) echo '<span style="color:red">'.$errors->first('field2').'</span>'; ?> | ||
|
||
<input type="submit"> | ||
|
||
</form> | ||
|
||
<?php if(isset($success)){ echo "Validation passed."; } ?> | ||
Example facade use: <?php echo {{Modulename}}::example() ?> |
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
67 changes: 67 additions & 0 deletions
67
src/Slider23/LaravelModulator/templates/formvalidation/Commands/ModulenameCommand.txt
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,67 @@ | ||
<?php namespace {{namespace}}\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class {{Modulename}}Command extends Command { | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'command:name'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command description.'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function fire() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
* | ||
* @return array | ||
*/ | ||
protected function getArguments() | ||
{ | ||
return array( | ||
array('example', InputArgument::REQUIRED, 'An example argument.'), | ||
); | ||
} | ||
|
||
/** | ||
* Get the console command options. | ||
* | ||
* @return array | ||
*/ | ||
protected function getOptions() | ||
{ | ||
return array( | ||
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null), | ||
); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/Slider23/LaravelModulator/templates/formvalidation/Controllers/ModulenameController.txt
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,33 @@ | ||
<?php namespace {{namespace}}\Controllers; | ||
|
||
use {{namespace}}\Forms\{{Modulename}}Form; | ||
use Laracasts\Validation\FormValidationException; | ||
|
||
class {{Modulename}}Controller extends \BaseController { | ||
|
||
private ${{modulename}}Form; | ||
|
||
public function __construct({{Modulename}}Form ${{modulename}}Form) | ||
{ | ||
$this->{{modulename}}Form = ${{modulename}}Form; | ||
} | ||
|
||
public function getExample() | ||
{ | ||
return \View::make("{{modulename}}/example"); | ||
} | ||
|
||
public function postExample() | ||
{ | ||
$input = \Input::only('field1', 'field2'); | ||
try{ | ||
$this->{{modulename}}Form->valdate($input); | ||
} | ||
catch (FormValidationException $e) | ||
{ | ||
return \Redirect::back()->withInput()->withErrors($e->getErrors()); | ||
} | ||
|
||
return \Redirect::back()->withSuccess(true); | ||
} | ||
} |
File renamed without changes.
28 changes: 28 additions & 0 deletions
28
src/Slider23/LaravelModulator/templates/formvalidation/Models/Modulename.txt
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,28 @@ | ||
<?php namespace {{namespace}}\Models; | ||
|
||
use Illuminate\Database\Eloquent\SoftDeletingTrait; | ||
use Laracasts\Presenter\PresentableTrait; // https://github.com/laracasts/Presenter | ||
|
||
class {{Modulename}} extends \Eloquent { | ||
|
||
protected $table = '{{modulenames}}'; | ||
protected $primaryKey = 'id'; | ||
public $timestamps = true; | ||
|
||
protected $fillable = []; | ||
protected $guarded = []; | ||
protected $hidden = []; | ||
|
||
use SoftDeletingTrait; | ||
protected $dates = ['deleted_at']; | ||
|
||
use PresentableTrait; | ||
protected $presenter = '{{namespace}}\Presenters\{{Modulename}}Presenter'; | ||
|
||
public static function boot() | ||
{ | ||
parent::boot(); | ||
// Setup event bindings... | ||
} | ||
|
||
}; |
Oops, something went wrong.