laravel-5.2

Eager Loading, Constraining Eager Loads, Lazy Eager Loading

巧了我就是萌 提交于 2019-12-06 14:54:56
I'm learning Laravel, and I'm using Laravel 5.2. I want to know about Eager Loading, Constraining Eager Loads, and Lazy Eager Loading. What are the similarities and differences between those three? Can you give an example for each of them? I have read Laravel documentation, but I still don't understand. I hope you can give clearer explanation. Thanks. Nutshell: Eager Loading allows you to get the relationships for some Models efficiently. Constraining Eager Loads Again makes it efficient but you can limit your results e.g. date range, specific id etc Lazy Eager Loading Is for when you already

Laravel 5.2 - Every route redirects to the homepage

≡放荡痞女 提交于 2019-12-06 14:39:50
I just started an laravel 5.2 application. Every route I take (/register, /logout, login,...) redirects me to the homepage. Here are my routes <?php Route::group(['middleware' => ['web']], function () { //Register Route::get('/register', 'Auth\AuthController@getRegister'); Route::get('/register/success', 'Auth\AuthController@getRegisterSuccess'); Route::post('/register', 'Auth\AuthController@PostRegister'); //Login Route::get('/login', 'Auth\AuthController@getLogin'); Route::post('/login', 'Auth\AuthController@PostLogin'); //Password Reset Route::get('/password/reset/email', 'Auth

Method controller does not exist.

泪湿孤枕 提交于 2019-12-06 14:17:43
So I have used this format again. In my routes.php I have Route::controller('datatables', 'HomeController', [ 'PaymentsData' => 'payments.data', 'getIndex' => 'datatables', ]); In my HomeController.php I have public function getIndex() { return view('payments.index'); } /** * Process datatables ajax request. * * @return \Illuminate\Http\JsonResponse */ public function Payments() { return Datatables::of(DB::table('customer'))->make(true); } Anytime I try php artisan I get [BadMethodCallException] Method controller does not exist. Question, is this form of doing it Deprecation or why anyone spot

Auth::attempt() is not working in Laravel 5.5

谁说胖子不能爱 提交于 2019-12-06 13:37:30
My registration form is working and it store users to db but when user login then Auth::attempt() return false. Here is my code for login. I store the password in db in sha1 encription. Route::post('login',function(){ $creds=array( 'email' => Input::get('email'), 'password' => sha1(Input::get('password')) ); $auth = Auth::attempt($creds); dd($auth); Even though you can implement a Service provider as describe in this post , You can do it manually by with using other auth method This means you can do like so: //.... try{ $user = User::where('email', Input::get('email')) ->where('password', sha1

Error: stream_socket_enable_crypto(): SSL operation failed with code 1. in laravel 5.2

♀尐吖头ヾ 提交于 2019-12-06 13:27:47
问题 Actually,I want to redirect my user to the email verification page after signup process and asking him/her to enter the verification code sent to his/her email. I will be glad if you tell me the process or recommend me any tutorial. I have already made my working authentication system . I have searched a lot on internet but all i can find is the requirement of laravel auth which i am not using. On signing up I am getting the error: stream_socket_enable_crypto(): SSL operation failed with code

Laravel 5 authentication middleware always redirects to root or login

南楼画角 提交于 2019-12-06 13:26:57
When I protect routes in Laravel 5 it works well when I'm not logged in because it redirects the protected routes to the login page but once I login and try to access the protected routes it redirects me to the root route. For example if I try to access /people or /people/1 it will redirect me to / Here's my routes.php file: Route::get('/', function () { return view('welcome'); }); Route::group(['middleware' => ['auth']], function () { Route::resource('people', 'PeopleController'); Route::resource('people.checkins', 'CheckinsController'); Route::model('checkins', 'Checkin'); Route::model(

Laravel - how to pass a parameter to a route? Is there a better practice?

心不动则不痛 提交于 2019-12-06 12:33:08
The simplified scenario is the following: I have a few pages in the database (ideally not more than 10-20, but there is no hard limit). They all have some content and a "slug" (there are slugs that contain a forward slash, if that matters). I'm trying to register route(s) to these slugs to a PageController that displays the content of the given page. Here are my ideas about the approach: Register a single "catch 'em all" route (which should be the very last registered route). This is definitely bad. Query all links from the database and register individual routes to them. This is easy, but I

upload my project laravel to a shared host

十年热恋 提交于 2019-12-06 11:59:59
I have a shared hosting service hostinger. as I can upload my laravel 5.2 and configure project? and I tried using: namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { // } /** * Register any application services. * * @return void */ public function register() { $this->app->bind('path.public', function () { return base_path() . '/public_html'; }); } } but still nothing. I guess easiest and better approach in this situation will be creating of a

Cannot make command line tool for artisan in PHPStorm 10.0.1

浪尽此生 提交于 2019-12-06 11:20:15
问题 I got this error message when I tried to make an alias for artisan: [Settings | Tools | Command Line Tool Support ] -> add -> tool based on Symfony Console Problem Failed to parse output as xml: Error on line 4: Content is not allowed in prolog.. Command C:\xampp\php\php.exe C:\xampp\htdocs\laratest\artisan list --xml Output [Symfony\Component\Console\Exception\RuntimeException] The "--xml" option does not exist. Ok, I know, what's the problem but I don't find any solution for this. Thank you

Laravel 5.2 queue ignores .env

谁都会走 提交于 2019-12-06 11:01:56
I have a Laravel 5.2 app which sends a few emails when a user buys a product. The email view includes references to some images, like so: <img src="{{ asset($purchase->image) }}"> This works fine in all 3 environments I have - local, staging, and production. asset() correctly constructs the fully qualified URLs to the appropriate image, using the configured APP_URLs in each environment. I decided to switch to using Laravel queues to send the emails. I changed the QUEUE_DRIVER in .env to database php artisan queue:table php artisan migrate php artisan queue:listen Changed \Illuminate\Support