Laravel 5 FatalErrorException Laravel 5 Socialite Facebook Login

I’ve just started to use Laravel and I’m trying to implement Socialite in my project in order to log in with Facebook and later to register users through it. I’ve watching the tutorial about Socialite on Laracasts, but I’ve got this error: "FatalErrorException in AuthenticateUser.php line 34: Call to a member function driver() on a non-object" I have no idea why it happens and I’d appreciate some help! Here is the code I have. AuthController class: <?php namespace App\Http\Controller

Laravel 5 flash message in auth controller

I'm looking for better solution to show flash message after login/logout/register. These methods are stored in AuthController through trait AuthenticatesAndRegistersUsers. My second condition is not to edit AuthenticatesAndRegistersUsers. My actually hack is below, but i'm not happy for that. Have you got better idea? app/http/controllers/auth/authcontroller.php public function postLoginwithFlash(Request $request) { return $this->postLogin($request)->with('flash_message','You are logged

Laravel 5 Laravel Homestead error on chown

i tried to install homestead but when i run vagrant up at the middle i got this error My folder structure is c:/Hashicorp/vagrant and the homestead at c:/Homestead I've added this line on my vagrantfile inside homestead: config.vm.synced_folder ".", "/vagrant" but still no luck. Virtual box version: 5.0 Vagrant version : 1.7.3 What should i do to make it running?

Laravel 5 unable to install laravel homestead using command line

i am trying to install laravel homestead in my windows 7 pc but every time fails it starts downloading but after some percentage it stops and display errors like "SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054" i have restarted download but every time after some percentage it stops i am tired now please help me i have installed "vagrant_1.7.4.msi" and "VirtualBox-4.3.30-101610-Win.exe" also

Laravel 5 Can Laravel Blade be used in a sandbox environment?

Can Laravel Blade be used in a sandbox environment, similar to Twig's sandbox extension? I have the need to allow users to use a template system but obviously do not want them executing arbitrary PHP code on the server. I would like to use Blade since it's already part of Laravel but suspect this isn't possible.

Laravel 5 Form request not working for controllers within subfolder of Controller folder

My folder structure for controllers is: and I use following route code to access those controllers. here I have allocated sub-folders inside Controller folder and updated namespaces as per needed on files and routes accordingly, this works perfectly, however when I use request file for validating form. It gives error: Argument 1 passed to App\Http\Controllers\site\usersController::store() must be an instance of Illuminate\Http\Request, string given but when I move all controllers file to

Laravel 5 Fields does not Update in laravel5

I am working on Laravel Form data Updation with image update. Now here my image only update smoothly in my DB. But other field does not update. anyone can identify what is my mistake? i attached my code below: Controller public function siteadmin_update_ads(Request $request) { $post = $request->all(); $cid=$post['id']; $name = $post['ads_title']; $url = $post['ads_url']; $img=Input::file('ads_image');; $v=validator::make($request

Laravel 5 Laravel 5 'a' character printed out

I have this issue where there's an 'a' character printed out on all the pages above everything else, it seems that it appears before the DOCTYPE, I can't find it anywhere! master.blade.php: <!DOCTYPE html> <html> <head> <title>@yield('title')</title> @include('elements.css') </head> <body> <div class="container-fluid"> @include('elements.html.navbartop') <div class="container" style="margin-top: 80px;margin-bottom: 40px"> @

Laravel 5 How do I bind a radio button value to my model? Laravel 5.3

I have a form with a couple of radio buttons; <div class="form-group{{ $errors->has('procurement') ? ' has-error' : '' }} col-md-6"> <label for="procurement" class="col-md-6 control-label">Procurement Type <span class="red">*</span></label><br> <div class="col-md-12"> <input id="procurement" type="radio" name="procurement" value="owned"> Owned <input id="procurement" type="radio" name="procurement" value="rental"> Rental @if

Laravel 5 Laravel 5.3 migration

I just upgrade to Laravel to 5.x and using "jenssegers/Date": "^3.0". So while migrating, there seems to be an error: [ErrorException] Declaration of Jenssegers\Date\Date::diffForHumans(Carbon\Carbon $since = NULL, $absolute = false) should be compatible with Carbon\Carbon::diffForHumans(Carbon\Carbon $other = NULL, $absolute = false, $short = false) Please suggest what can be done to fix it.

Laravel 5 Laravel 5.4 relationships with all()

I have two tables, QA and QACategories. QA has the usual fields (increment etc) and also a field category_id. QA categories has the usual plus a field "category". The model for QA is: class QandA extends Model { protected $table = 'qa'; public function category() { return $this->hasOne('QACategories::class'); } } and the QACategories is class QACategories extends Model { protected $table = 'qacategories'; public function question() { retu

Laravel 5 Vuejs + Laravel + HTML

Hello Stackoverflow community, i need to use Vue Axios / Resource, i managed to make a HTML select box loaded from my database in my view, after i select any record i need to use another value from that record and put it into an HTML input, for example: in my html select i click on my "stpr_tx_descripcion" attribute, after that i need another atribute, the "stpr_in_ticket", but i don't know how make it dynamically. This is what i got so far: Im using Laravel to return a query object to my view

Laravel 5 Laravel 5.5 - Handling PostTooLargeException for large base64 image?

I have a limit of 10MB to accept per image and anything larger should prevent execution of the code. I am not sure how to do so. Here is what I tried: In the controller method: // Increase memory limit before processing ini_set('memory_limit','256M'); $base64_image = $request->get('base64_image'); $image = Image::make($base64_image); // Returns 0, looks like we have to encode image to get file size... $image_size = strlen((string) $image); Log::critical('image_size file size from string:

Laravel 5 If you are using v-if on multiple elements, use v-else-if to chain them instead. Laravel + VueJs

First question - How to create components in a loop? In my Index.vue I have a loop <div v-for="(image, id, index) in images" class="col-md-4"> <photo :src ="image.src" :symbolId="image.id" :photoId="image.photo_id" :index="index"></photo> </div> in my app.js i registered a component Vue.component('photo', require('./components/Photo.vue') ); and in my Photo.vue <template> <img v-on:click="replaceImages()" :src="src" class="img-responsive image"

Laravel 5 Laravel models and fields containing serialized array

Let's say I have a model "Product", which is linked to the "products" table. This table has a text field "info", which contains a serialized array. I'm happy for this array to be serialized as json, php serialization, or any other way. Does Laravel have a built in way for me to access the values stored in json? Ideally I'd like to access them in some way like this: $product->info->price Sample array: "price" => "6.00", "sellby" => "2018-02-05"

Laravel 5 Laravel batch file upload

I have a csv file with the following structure: id,title,sub_title,filename 1,Title 1, Sub Title 1,filename_1.mp3 2,Title 2, Sub Title 2,filename_2.mp3 3,Title 3, Sub Title 3,filename_3.mp3 (...) I'm loading the CSV file inside a App\Console\Command (artisan command). Assuming the files exist on the filesystem and the path is correct, for each csv line how can I upload the related file and validate it using the Validator class? I'm using this code: $validator = Validator::make(array('f

Laravel 5 Trying to get intended url in LoginController in Laravel 5.6

I'm trying to capture the intended url in my LoginController so I can execute some logic in a showLoginForm() method I added to the controller so I can send the user to a specific view based on the intended URL. I've tried the following and I cannot get it to work: public function showLoginForm() { $intededUrl Session::put('url.intended', URL::full()); // my base application url is http://www.websites.com:8080 if (starts_with($intededUrl, url('/admin'))) // i want all routes that begin

Laravel 5 Change config value dynamically in laravel

how to change Laravel database name in config file dynamically. i know the value for database, after some function is executed in controller. after change config value i can able access the new value from other controllers too. 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' =

Laravel 5 concatenation in laravel controller goes wrong

this is the code in my controller(laravel project 5.5) want to generate the url in view like localhost/learning/notice_details/1 in my project url() returns localhost/learning but i m unable to genrate the right href link may something wrong with concatenation or .... ??

Laravel 5 Laravel Mix, a right way to install PhotoSwipe lib

I try to include PhotoSwipe into my project. And the question how to right way to include all the lib files, JS, CSS and images. I do something like this - yarn add photoswipe Than at bottom of esources/assets/js/bootstrap.js I add window.PhotoSwipe = require('photoswipe'); But I also need include extra JS (photoswipe-ui-default.js) not described in package.json, don't sure is this a correct way? mix.copy('node_modules/photoswipe/dist/photoswipe-ui-default.js', 'public/js'); <script

Laravel 5 Laravel disable column in eleoquent model

We have an application with a table, what i want is to disable/read-only one column in my Model, in my example fakecolumn. So not massasign with $fillable. I don't want any actions tobe done on that specific column. Table: id name email fakecolumn How can i achieve that and is it also possible?

Laravel 5 Displaying logged tickets for CompanyX when user with role X is logged in

I am setting up an app where citizens can log tickets online to companies registered on our app. We have 5 types of User Roles - [ App Super Admin, App Admin & App Support User ] ** Must see all logged tickets for all companies - [ Company Admin & Company Support User ] ** Must see only tickets for their company - [ App User ] ** Must see only their own logged tickets Problem is that I see all tickets for all companies, irrespective of which user is logged-in. I want the logged-in Co

Laravel 5 Where to find this Client.php laravel

I upgraded my php version in WSL to 7.4 and I am running an application built with laravel-5.5. When I run php artisan in the command line I got this error In Client.php line 1551: Undefined variable: version There are many $version available where do I find this Client.php this error talking about? There is no log record in the log about this. Thanks

Laravel 5 Sending temporary attachment to email not working in Laravel 5.8

I'm trying to send attachment from form input via Notification email but I keep getting "Serialization of 'Illuminate\Http\UploadedFile' is not allowed" error. This is my controller function: /** * @param InterviewRequest $request * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function interviewPost(InterviewRequest $request) { $contactForm = $request->all(); $contactForm['country_code'] = config('country.code'); $contactFor

Laravel 5 Laravel DataTables search in column generated with DB::raw

I have the following issue in Laravel DataTables (yajra/laravel-datatables ): I can't search (filter) in a column generated with DB::Raw. Also I can't search with Global search function. In my Laravel Controller: $inputs = Input_::join('companies', 'companies.id', '=', 'inputs.company_id') ->leftjoin('inputs_details', 'inputs_details.input_id', '=', 'inputs.id') ->select(array('inputs.id as id', 'inputs.created_at as created_at', 'inputs.updated_at as updated_at', 'inputs.i

Laravel 5 Passing an id to other controller

I want to pass user id in this array which is in other table what should I do? The field is a foreign key. When I run this it throws an exception SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`freight`.`jobs`, CONSTRAINT `approved_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)) (SQL: insert into `jobs` (`company_id`, `origin`, `commodity`, `destination`, `created_b

Laravel 5 How to use Solarium with Laravel?

I've included Solarium as required on composer.json, did composer install and everything went fine. However, when I try to create a client stance, I get an error: Class 'Solarium\Client' not found The code I'm using goes like this: public function __construct() { $config = array( 'endpoint' => array( 'localhost' => array( 'host' => '127.0.0.1', 'port' => 8983, 'path' => '/solr/my_solr_instance',

Laravel 5 session value not printed on blade page

session value not displayed on blade page adminController use Session; Session::put('adminusername', "test"); echo Session::get('adminusername'); //it prints here fine mater.blade.php Welcome:{!! Session::get('adminusername') !!}

Laravel 5 Set mocked Eloquent model public attributes

I have a model Model1 that has many Model2. An instance of Model1 is passsed as a paramer to the fuction that I want to test. the function that I would like to test looks like this: function funnctionTotest(Model1 $moel1) { foreach($moel1->model2s as $model2) { .... } } The example below does not work. I am putting it here as a starting point for a real solution (array() should be replaced by something else maybe a collections of Model2 instances). $mock = $this->getMockBui

Laravel 5 How to store multiple images paths into database in laravel?

I am working on multiple image upload in laravel. Uploading is successful but, i got an issue. For later use i should store in database. For single column it easy but for different column for different images i couldnot do it. Here is my image upload code $images = []; $destDir = "public/uploads/"; if($request->file('image1')) $images[]=$request->file('image1'); if($request->file('image2')) $images[]=$request->file('image2'); if($request->file('image3')) $i

Laravel 5 Laravel Send Mail fails

I installed laravel on my localhost server, i already configured my .env email setting. This is my .env email setting MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=my@gmail.com MAIL_PASSWORD=mypassword MAIL_ENCRYPTION=tls This is the error i get. ErrorException in StreamBuffer.php line 95: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Is ther

Laravel 5 Throwing custom validation exceptions/errors in Laravel 5.3

I am upgrading Laravel from 5.2 to 5.3. In 5.2, I was throwing Illuminate\Contracts\Validation\ValidationException (using my own validation logic) like so: $this->errors = new MessageBag(); ... ValidationException($this->errors); In 5.3, Illuminate\Contracts\Validation\ValidationException is removed. How do I keep the same blade output behaviour? Do I simply recreate ValidationException? // In blade, this should still print error. (JSON should keep same behaviour too) @if (count($error

Laravel 5 Laravel Select the First Row From HasMany Relation

I have 2 table where 1 products have many prodphotos I can retrieve all prodphotos from products with the same id, but my case is listing all the products but only take 1 photo from prodphotos. Controller : public function daftarproduk() { $produks = Product::orderBy('created_at', 'desc')->get(); $select = Product::with('prodphotos')->firstorfail(); $photo = $select->prodphotos->pluck('photo'); $kategori = Category::orderBy('created_at', 'asc')->get();

Laravel 5 query returning wrong result for like'%'

like % not working . the query returning result for full string match not the substring match. Booking::whereHas('agent', function ($query) use ($agent_name) { $query->where('first_name', 'like', "'%".$agent_name."%'"); })->select('id','agent_id','file_number','title','first_name','last_name','ref_number','pax_adult','pax_child')->with(array('agent'=>function($query){ $query->select('id','first_name','last_name'); }))->get();

Laravel 5 Laravel global session helper is not working

I'm using Laravel version 5.4.36 and global session helper is not working anymore. Here is what I did: when a logged in user access a controller function, I need to save some data and when user refresh(reload) the page then I want to keep that data but it seems global session helper is not doing this. Is something I'm doing wrong? My session is file based. I followed official doc but unfortunately no help :) Storing data with $request->session()->put(...) is useless in my case because w

Laravel 5 Testing focus in Laravel Dusk

I'm wondering if there is any way to test for where focus is set on a page, using Laravel Dusk. I have a form whose first element should always receive focus when the page loads. I don't see anything obvious in the Dusk documentation for this. I'm using Laravel 5.5.

Laravel 5 seperate DB for each laravel/homestead project

I've come across so many posts about this problem but albeit am following all the solutions its still not working for me this is my homestead.ymal sites: - map: homestead.com to: /home/nanashi/public - map: boomer.com to: /home/boomer/public databases: - homestead - boomer my .env file DB_CONNECTION=mysql DB_HOST=192.168.10.10 DB_PORT=33060 DB_DATABASE=boomer DB_USERNAME=root DB_PASSWORD= I have several migration and while I try to run it from the vagrant mac

Laravel 5 How to get related products in a laravel-nestedset?

Laravel 5.7 in Category model: public function parent() { $parent = $this->belongsTo('App\Category', 'parent_id'); return $parent; } public function children() { return $this->hasMany('App\Category', 'parent_id'); } public function product() { return $this->belongsToMany(Product::class); } public function products() { return $this->hasMany(Product::class); } I created a nested category like this: Root > Cat1 > cat2

Laravel 5 Laravel Eloquent How can I select and manipulate rows in pivot table?

I have three database tables called user(id,name), group(id,name) and user_group(user_id, group_id,valid_before) with relations many to many. class User extends Model { protected $table = 'user'; public function groups() { return $this->belongsToMany(Group::class, 'user_group') ->withPivot('valid_before'); } } class Group extends Model { protected $table = 'group'; public $timestamps = false; public function user() { return $this-&g

  1    2   3   4   5   6  ... 下一页 最后一页 共 12 页