laravel-4

How to add slug and ID URL to Laravel 4 Route?

随声附和 提交于 2019-12-04 12:31:21
问题 I would like to add nice Slug URL to my Laravbel Project. I currently am using ID numbers. My goal is to continue using Numbers but also to use Slugs for better SEO URL's. So either a Slug or an ID will load the proper page. Below is my current Route that uses an ID number to load a record. // View Campaign Details/Profile/Map View Route::any("/campaign/{id}", array( "as" => "campaign/{id}", "uses" => "CampaignController@getCampaignMap" )); To be able to add Slug support in Laravel 4. I

Is safe to store an access token in a client cookie if the cookie is not send to the server

。_饼干妹妹 提交于 2019-12-04 12:11:36
I'm developing a backbone application with a REST api to a Laravel back end. It means that I authenticate on every request, using the access token that I receive from the social media (eg. Facebook, Google, etc). My plan was to store a client side cookie generated with Javascript to store the access token, so that I can send it to the back end to authenticate the user with my application, and so that it is possible to request resources on the server of the social medium (such as friends list, photos, etc). Note that I make an additional check with the FB server in my back end with PHP.

Multiple tables in one model - Laravel

独自空忆成欢 提交于 2019-12-04 12:03:48
My Index page uses 3 tables in the database: index_slider index_feature footer_boxes I use one controller (IndexController.php) and call the three models like so: public function index() { return View::make('index') ->with('index_slider', IndexSlider::all()) ->with('index_feature', IndexFeature::all()) ->with('footer_boxes', FooterBoxes::all()); } The three models above need ::all() data, so they are all setup like this: class IndexSlider extends Eloquent { public $table ='index_slider'; } note: class name changes for each model Seeing as my index page requires these 3 tables and the fact I am

Laravel 4.2 Validation Rules - Current Password Must Match DB Value

大城市里の小女人 提交于 2019-12-04 12:01:42
问题 On the password reset form the user supplies current_password , password and password-confirmation . Is there a way to specify in the validation rules that current_password (it's hash value) must match the database value? Currently I have this: $rules = array( 'current_password' => 'required', 'password' => 'required|confirmed|min:22' ); Thank you. UPDATE Thanks to @ChrisForrence and @Ben, I came up with the following which works great! Much appreciated. Hope this will help someone else:

Laravel 4.1: proper way to retrieve all morphedBy relations?

爷,独闯天下 提交于 2019-12-04 11:54:05
问题 Just migrated to 4.1 to take advantage of this powerful feature. everything seems to work correctly when retrieving individual 'morphedByXxxx' relations, however when trying to retrieve all models that a particular tag belongs to -- i get an error or no results. $tag = Tag::find(45); //Tag model name = 'awesome' //returns an Illuminate\Database\Eloquent\Collection of zero length $tag->taggable; //returns Illuminate\Database\Eloquent\Relations\MorphToMany Builder class $tag->taggable(); /

Laravel dosen't connect with Oracle

我们两清 提交于 2019-12-04 11:49:19
I'm using yajra/laravel-oci8 for Oracle connection with laravel. But I couldn't connected to Oracle, from my client PC to Server. showing this error: I'm using this code in database.php: 'oracle' => array( 'driver' => 'oracle', 'host' => '192.168.152.189',// this is my server IP 'port' => '1521', 'database' => 'ocp', 'username' => 'ocpl', 'password' => '123456', 'charset' => 'AL32UTF8', 'prefix' => '', 'port' => 1521 ), But I'm connected with Sql Developer. see the Sql-Developer Property: problem in this line : 'database' => 'ocp' , solve it with : 'database' => 'orcl' , or 'database' => '192

Could not find driver while migrating on Laravel 4 using XAMPP Server Linux (Ubuntu)

两盒软妹~` 提交于 2019-12-04 11:40:52
I have installed Laravel 4.1 everything worked just fine, but when I try to use migration it throws a PDO Exception saying: [PDOException] could not find driver I found many answers on StackOverFlow, but none of them solved my problem, unfortunately. I have tried to enable pdo extension and pdo_mysql extension, but it says that pdo is already loaded. I have tried to reinstall PDO and PDO MySQL but nothing worked. I am using XAMPP Server on a Ubuntu 64bit machine. Thank you in advance. If you are looking for simple solution, I had same issue & this worked for me.. When you run php artisan from

Auth filter redirecting back to original POST request in Laravel

回眸只為那壹抹淺笑 提交于 2019-12-04 11:39:50
问题 It seems that Redirect::guest('login') will only work for GET requests. Ie. it will redirect an authenticated user to the original intended URL (GET). In a situation where there is a POST request, is there a way for the auth filter to continue on to POST to a URL after the user has successfully logged on? A simple example: I want to show a form available to anyone to view. Upon hitting the submit button, the auth filter kicks in which will bring a guest to the login page. After successful

Laravel 4 testing session in controllers

可紊 提交于 2019-12-04 11:37:54
I have a problem with testing controllers in Laravel 4. I have the next code: public function getRemind() { $status = \Session::get('status'); $error = \Session::get('error'); $email = \Session::get('email'); return \View::make('admin/reminds/remind_form', compact('status', 'error', 'email')); } And I want to test if correct data passed in views by controller: public function testGetRemind() { \Session::set('status', 'status'); \Session::set('error', 'error'); \Session::set('email', 'email'); $response = $this->action('GET', 'Admin\RemindersController@getRemind'); $this->assertTrue($response-

Laravel Mail::send how to pass data to mail View

别等时光非礼了梦想. 提交于 2019-12-04 11:34:03
问题 How can i pass data from my Controller to my customized mail View ? Here's my controller 's send mail method : $data = array($user->pidm, $user->password); Mail::send('emails.auth.registration', $data , function($message){ $message->to(Input::get('Email'), 'itsFromMe') ->subject('thisIsMySucject'); Here's my emails.auth.registration View <p>You can login into our system by using login code and password :</p> <p><b>Your Login Code :</b></p> <!-- I want to put $data value here !--> <p><b>Your