Through an error using Unisharp laravel file manager - laravel-5.4

i have update laravel 5.3 to 5.4 than i got this error for using laravel filemanager package Unisharp.
FatalErrorException in ItemsController.php line 0: Method
Illuminate\View\View::__toString() must not throw an exception, caught
ErrorException: Cannot use object of type stdClass as array (View:
ProjectName\resources\views\vendor\laravel-filemanager\item.blade.php)
(View:
ProjectName\resources\views\vendor\laravel-filemanager\item.blade.php)
return [
'html' => (string)view($this->getView())->with([
'files' => $files,
'directories' => $directories,
'items' => array_merge($directories, $files)
]),
'working_dir' => parent::getInternalPath($path)
];

add in the vendor views item.blade.php in the line 0
<?php $file = json_decode(json_encode($file),true) ; ?>

Related

Class Swift_Transport_Esmtp_Auth_CramMd5Authenticator does not exist

I can't seem to send an email with laravel 5.4 on after setting the right configurations in config/mail.php. I'm using smtp driver here is summary of my files.
Here is the config/mail.php
<?php
return [
'driver'=>env('MAIL_DRIVER', 'smtp'),
'host'=>env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'info#afecamworld.org'),
'name' => env('MAIL_FROM_NAME', 'National President'),
],
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('MAIL_USERNAME', 'my-gmail-email'),
'password' => env('MAIL_PASSWORD', 'my-gmail-password'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
This is the SendActivationEmail class
<?php
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class SendActivationEmail extends Notification {
use Queueable;
protected $token;
public function __construct($token) {
$this->token = $token;
}
public function via($notifiable){
return ['mail', 'database'];
}
public function toMail($notifiable) {
return (new MailMessage)->subject('Activation Your Account')->greeting('Hello!')->line('You need to activate your email before you can login.')->action('Activate Email', route('activate_account', ['token' => $this->token]))->line('Thank you for joining our Online Community!');
}
}
?>
This is the top part of the error
(1/1) ReflectionException
Class Swift_Transport_Esmtp_Auth_CramMd5Authenticator does not exist
in DependencyContainer.php (line 309)
I will be grateful for any help to resolve this error on dreamhost, thanks.
The best way to resolve this problem is to delete the files in the vendor folder and redo composer install and composer update, that's how I fixed my problem

Fatal error: Class 'mPDF' not found in myproject/vendor/kartik-v/yii2-mpdf/Pdf.php on line 281

I have used kartik pdf extension to print my report in pdf format.Things are going well in my local computer but when i put my codes in server error appears like this:
Fatal error: Class 'mPDF' not found in myproject/vendor/kartik-v/yii2-mpdf/Pdf.php on line 281
In server i have uploaded yii2-mpdf folder inside kartik-v folder and also mpdf folder.
My code of controller for pdf print:
use kartik\mpdf\Pdf;
public function actionPearlFinancialReport()
{
$pdf = new Pdf([
//'mode' => Pdf::MODE_CORE,
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_BROWSER,
'content' => $this->renderPartial('_financial_report', ['model' => $model,'parameter'=>$parameter]),
'cssFile' => '#vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
'cssInline'=> '.kv-heading-1{font-size:15px;text-align:center;}',
'options' => ['title' => 'Pearl Financial Report'],
'methods' => [
'SetHeader'=>['Pearl Financial Report'],
'SetFooter'=>['{PAGENO}'],
]
]);
$response = Yii::$app->response;
$response->format = \yii\web\Response::FORMAT_RAW;
$headers = Yii::$app->response->headers;
$headers->add('Content-Type', 'application/pdf');
}
What to do?
Try this
'cssFile' => '#vendor/kartik-v/yii2-mpdf/src/assets/kv-mpdf-bootstrap.min.css',
Try to register this extension with composer:
For example my work directory is c:\xampp\htdocs\my-project
In a command prompt -> cd c:\xampp\htdocs\my-project
And register with this command:
C:\xampp\htdocs\my-project>php c:\xampp\htdocs\composer.phar require kartik-v/yii2-mpdf "dev-master"
I always register kartik's extensions with this metod, I hope want to be useful for you too.

yii2 stripe include error (class not found)

Yii2 Framework.
Installed Stripe (https://github.com/stripe/stripe-php) by composer:
composer require stripe/stripe-php
And inserted to the view:
\Stripe\Stripe::setApiKey('sk_test_...');
$myCard = array(
'number' => '4242424242424242',
'exp_month' => 8,
'exp_year' => 2018
);
$charge = \Stripe\Charge::create(array(
'card' => $myCard,
'amount' => 2000,
'currency' => 'usd'
));
echo $charge;
And now framework can't find Class:
Error
Class 'Stripe\Stripe' not found
What should I do next?
Did you correctly include Composer's autoload file?
You should have a require statement similar to this near the beginning of your code:
require_once('vendor/autoload.php');
cf. Stripe's PHP library's README file and Composer's documentation.

Laravel save image using dropzone.js into MySQL

I'm just trying out dropzone for the first time and would need assistance to set it up. I am getting error 500 thus:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
This is the controller:
public function storeDocument(Request $request){
$file = $request->file('file');
$fileName = uniqid().$file->getClientOriginalName();
$file->move('gallery/images', $fileName);
$productVerificationValidation = ProductVerificationValidation::findOrFail($request->productDocumentNameId);
$documentsUploaded = $productVerificationValidation->productDocumentUpload()->create([
'gallery_id' => $request->productDocumentNameId,
'user_id' => Auth::user()->id,
'company_id' => $request->company_id,
'product_id' => $request->product_id,
'file_name' => $fileName,
'file_size' => $file->getClientSize(),
'file_mime' => $file->getClientMimeType(),
'file_path' => 'gallery/images'. $fileName
]);
}
This is the route to store the image credentials:
Route::post('product/document/upload/save', array('before'=>'csrf', 'uses'=>'ProductVerificationValidationController#storeDocument'));
This is the form for Dropzone:
<form action="{{url('product/document/upload/save' )}}"
class="dropzone first-input-div" id="addImages">{{csrf_field()}}
{!!Form::hidden('productDocumentNameId', $productVerificationValidation->id)!!}
{!!Form::hidden('product_id', $productVerificationValidation->product_id)!!}
{!!Form::hidden('company_id', $productVerificationValidation->company_id)!!}</form>
This is the model setup:
public function productDocumentUpload(){
return $this->hasMany('App\ProductDocumentUpload');
}
I'm yet to understand what I need to do right. Please help out.

Zend_Loader_PluginLoader_Exception ERROR

I have try to simulate and develop base of some zend project
and in first step I copy all FTP file & folder to my local computer
but application send me below error (in loading plugin from source )
( ! ) Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name '_' in C:\wamp\Mina\library\Zend\Loader\PluginLoader.php on line 398
( ! ) Zend_Loader_PluginLoader_Exception: Plugin by name '_' was not found in the registry; used paths: Mina_View_Helper_: Mina/View/Helper/ App_View_Helper_: App/View/Helper/ Zend_View_Helper_: Zend/View/Helper/;C:/wamp/Mina/application/modules/default/views\helpers/ in C:\wamp\Mina\library\Zend\Loader\PluginLoader.php on line 398
even some plug in exsist that hides in var_dumped error array in pluginloader.php line 398
like this:
string 'Db' (length=2)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Translate' (length=9)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Layout' (length=6)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Frontcontroller' (length=15)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'ViewRenderer' (length=12)
array
'Zend_Controller_Action_Helper_' =>
array
0 => string 'Zend/Controller/Action/Helper/' (length=30)
string 'Navigation' (length=10)
array
'Mina_View_Helper_' =>
array
0 => string 'Mina/View/Helper/' (length=16)
'App_View_Helper_' =>
array
0 => string 'App/View/Helper/' (length=16)
'Zend_View_Helper_' =>
array
0 => string 'Zend/View/Helper/' (length=17)
1 => string './views\helpers/' (length=16)
string 'View' (length=4)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Modules' (length=7)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Router' (length=6)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Word_CamelCaseToDash' (length=20)
array
'Zend_Filter_' =>
array
0 => string 'Zend/Filter/' (length=12)
string 'StringToLower' (length=13)
array
'Zend_Filter_' =>
array
0 => string 'Zend/Filter/' (length=12)
that mines some plugins doesn't exist
but original project works with this situation
in further convey i find that index.php references some library that i cant see with any tricks on FTP server
(Line 5 Of Below Code:)
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../library'),
realpath(APPLICATION_PATH . '/../library'),
realpath(APPLICATION_PATH . "/models"),
realpath(APPLICATION_PATH . "/forms"),
get_include_path(),
)));
tree map of original project Going on this link
in further there is not any navigation.php in my library folder not like that errors says (except zendframework classes)
and every of this namespace (and view helpers) are registred in application.ini
because no plugins have runs no page are displayed.
Share me if you had any idea about this error
I have no idea if this is the correct answer, but its worth a shot...
The simplest way I could think of to reproduce this error myself was to insert the following code into one of my views:
<?php echo $this->_( 'Some text' );?>
This suggests to me that maybe your application uses the gettext module for language translation, and maybe it is configured on your server but not on your local machine. Running phpinfo() should confirm this fairly quickly. This is the only explanation I can deduce from the information I have gleaned from your question.
Of course, if somebody had used gettext to multi-lingualize the app, I'm pretty sure they would not have included "$this->" before the underscore, so this is a bit of an anomaly in my answer.