Laravel
Run Sentry’s Migration When Running Laravel’s Migration
[php] <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreateSentryTables extends Migration { /** * Run the migrations. * * @return void */ public function up() { Artisan::call(‘migrate’, [‘–package’ => ‘cartalyst/sentry’]); } /** * Reverse the migrations. * * @return void */ public function down() { // Not required. Laravel will use Sentry’s down function. } }…
Laravel – Validate Multiple Models and Combine All Error Messages
[php] <?php $validateUser = Validator::make(Input::all(), User::$rules); $validateRole = Validator::make(Input::all(), Role::$rules); if ($validateUser->fails() OR $validateRole->fails()) : $validationMessages = array_merge_recursive($validateUser->messages()->toArray(), $validateRole->messages()->toArray()); return Redirect::back()->withErrors($validationMessages)->withInput(); endif; ?> [/php]
Laravel 4 – Get Path to App, Public, Storage and Base Install Directories
[php] <?php /** * Path to the ‘app’ folder */ echo app_path(); /** * Path to the project’s root folder */ echo base_path(); /** * Path to the ‘public’ folder */ echo public_path(); /** * Path to the ‘app/storage’ folder */ echo storage_path(); ?> [/php]