In my circumstances, I found it easier to separate all the data into a separate table and model, and add a foreign key in the pivot table to the additional table record. This allows me to use the 'normal' model handling in Laravel and means I don't have to mess...
php,validation,laravel,laravel-5.1
It is messages, not message. Change public function message() to public function messages() ...
jquery,ajax,form-data,laravel-5.1
Remove the curly braces from the formData when passing to the jquery parameter. <script> var form = $('#postAddProject'); var button = $('#project-button'); var name = $('#name'); var link = $('#link'); var image = $('#image'); var token = $('input[name=_token]'); var message = $('#message'); var name_error = $('#name-error'); var link_error = $('#link-error');...
php,laravel,eloquent,laravel-5,laravel-5.1
Before I compare the options, there is a third one: Using associate() with just the id $emp->employeeTypes()->associate($request->employee_types_id); Now let's see what the advantages and disadvantages of the methods are: 1. Setting the foreign key manually Pro: It's the simplest method Contra: You have to explicitly use the foreign key column...
php,unit-testing,laravel,phpunit,laravel-5.1
You just have to change "get" to "set" in your method name. Methods starting with "get" are accessors. These are not supposed to change the field / attribute value but return a "mutated" value (yours returns nothing that's why you get null). Methods starting with "set" are designed to change...
You can use a join to select the User model associated with each friend_id. In your route, replace your $friends = ... line with this: $friends = DB::table('usuarios') ->join('friends', 'friends.friend_id', '=', 'usuarios.id') ->where('friends.user_id', '=', $usuario->id) ->get(); This will return the collection of Users who are friends with $usuario But there...
DB::purge('mongodb-name'); i used this after Config::set("Key","value"). And its work for me.
php,laravel,phpunit,laravel-5.1
You are getting that error because you don't have any users in your database. First, when you use DatabaseMigrations in your tests Laravel goes ahead and runs your migrations before every single test and performs a "rollback" after every single test. That way you have a fresh database for every...
Your created_at column is probably set to be auto-updated.
php,laravel,laravel-5,laravel-5.1
In your code you disable soft delete constraint on the query that fetches the brand, not the image. Try the following: static::restoring(function($brand) { $brand->image()->withTrashed()->get()->restore(); }); Please note that there is no need to fetch the $brand object as it's passed to the restoring callback automatically....
php,jquery,mysql,json,laravel-5.1
You can render a view like this: <?php $html = view('wall/post')->render(); ...
php,laravel,routing,laravel-5,laravel-5.1
This is because you access your site from http://localhost. Every file and folder that is inside your root folder is accessible via the browser. So don't run your project from localhost but from a proper virtual host. For example make http://project.dev and use that to access your site <VirtualHost *:80>...
php,laravel,exception,laravel-5,laravel-5.1
When Form Request fails to validate your data it fires failedValidation(Validator $validator) method that throws HttpResponseException with fresh Redirect Response, but not HttpException. This exception is cached via Laravel Router in it's run(Request $request) method and that fetches the response and fires it. So you don't have any chance to...
php,laravel,laravel-5,laravel-5.1
The events you need to listen on are: auth.login - fired when user logged in successfully auth.logout - fired when user logged out auth.attempt - fired when user attempts to log in Those are the events that Laravel fires automatically - see Illuminate\Auth\Guard class which is what you get when...
laravel,eloquent,laravel-5,laravel-5.1
setRelation() should work. It just sets the value in the relations array. $owner->setRelation('domain', $domain); ...
php,laravel,laravel-5,laravel-5.1
There are 3 things you need to do. Pass plain-text password to Auth::attempt() as Laravel will hash that itself before verifying it against the hash stored in the database. Auth::attempt(['u_email'=>$credentials['email'],'password' => $credentials['password']]); Pass password as password, not u_password to Auth::attempt(). The key doesn't need to match the password column name...
Add these links into page head {!! HTML::style('css/default.css') !!} Copy these files to /css/js and link them to your page: {!! HTML::script('css/js/jquery.nivo.slider.js') !!} {!! HTML::script('css/js/jquery.nivo.slider.pack.js') !!} Then copy this into index page or view : <div id="wrapper"> <div class="slider-wrapper theme-default"> <div id="slider" class="nivoSlider"> <img src="../images/toystory.jpg" data-thumb="../images/toystory.jpg" alt="" /> <a href="http://dev7studios.com"><img...