jeudi 13 octobre 2016

Any alternative of mysql_real_escape_string in laravel 5.2

How to use mysql_real_escape_string in laravel 5.2,i get to now laravel use PDO can anyone give exaple of that?



via Chebli Mohamed

Getting error after composer update

I am getting the following errors after a composer update on a Laravel project:

Warning:require(/home/vagrant/Code/acme/vendor/composer/../../app/helpers.php): 
failed to open stream: No such file or 
directory in /home/vagrant/Code/acme/vendor/composer/autoload_real.php 
on line 66

Call Stack

1   0.0005  361704  {main}( )   .../index.php:0

2   0.0021  361952  require( '/home/vagrant/Code/acme/bootstrap/autoload.php' ) .../index.php:22

3   0.0177  362944  require( '/home/vagrant/Code/acme/vendor/autoload.php' )    .../autoload.php:17

4   0.0214  364424  ComposerAutoloaderInite893eea6f4734f123846aeff2dfd0c15::getLoader( )    .../autoload.php:7

5   0.1658  506328  composerRequiree893eea6f4734f123846aeff2dfd0c15( )  .../autoload_real.php:56

and the following error:

Fatal error: require(): Failed opening required '/home/vagrant/Code/acme/vendor/composer/../../app/helpers.php' (include_path='.:/usr/share/php') in /home/vagrant/Code/acme/vendor/composer/autoload_real.php on line 66
Call Stack

1   0.0005  361704  {main}( )   .../index.php:0

2   0.0021  361952  require( '/home/vagrant/Code/acme/bootstrap/autoload.php' ) .../index.php:22

3   0.0177  362944  require( '/home/vagrant/Code/acme/vendor/autoload.php' )    .../autoload.php:17

4   0.0214  364424  ComposerAutoloaderInite893eea6f4734f123846aeff2dfd0c15::getLoader( )    .../autoload.php:7

5   0.1658  506328  composerRequiree893eea6f4734f123846aeff2dfd0c15( )  .../autoload_real.php:56

Line 66 of /home/vagrant/Code/acme/vendor/composer/autoload_real.php is the the line require $file; of the following method:

function composerRequire1601035f2d74a33e13617fd13fa9786b($fileIdentifier, $file)
{
    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
        require $file;

        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    }
}

I have tried to completely re-install the composer dependencies by the following:

  • run rm -r vendor
  • run rm composer.lock
  • run composer clear-cache
  • run composer install

But this has had no effect and the errors persists with a fresh install.



via Chebli Mohamed

laravel 5.1 download docx file not working

Im trying to force the download a docx file from a folder (named 'cvs') in the public folder and is not working. I don't get an error it just shows a lot of weird symbols in the console instead of pushing the download. in my controler what i do is this:

return response()->download(public_path('cvs/56_dummyFile.pdf', 'CV-'.$details['applicant'].$doxType));

Note: $doxType is just the extension.

in this example im forcing (or trying) the download, but no download happens. The response from the server is ok and all i can see in the response is (this is just a fragment):

`3��b�6�0Ln3�ę�ӯH.x��֠��P�"U�j�+�g��L���7PCc�6����s�2O�f��kc��j|]�Q�?�t�Z�����������r%?o��@��2��ʪJ�L�\_�3$h(�u���DO�'O��0ׯ=��J������U��}�v�W��>�,�������u�@C�]l���>`

any ideas? Thanks in advance!



via Chebli Mohamed

Best way to store images in database and display directly from database in model?

What is the the best way to store and display images in the model directly from the database. I do not want to save to local storage or load from database in the controller and then pass to model. If possible.Thanks in advance.



via Chebli Mohamed

laravel Auth::login login not working

here is my code i am trying to login but its not working, data comes till before but something wrong in -> Auth::login($user1); though if i put Auth::login($user1); in if() condition it goes inside but not redirect in if condition,

        if(count($staff) > 0)
       {
       $staff['0']['type']='staff';
        $staff['0']['name']=$staff['0']['emp_name'];

        unset($staff['0']['emp_name']);
        Session::put('user',$staff['0']);

        $id= $staff[0]['id'];

        $user1 = Staff::find($id);
        //print_r($user);exit;
        //return Auth::login($user);
        Auth::login($user1);

        return redirect()->intended('/student');

    }



via Chebli Mohamed

mardi 11 octobre 2016

Laravel permission issue in server

I have given 'storage/framework/session' folder to 755 recursively but session created inside it has 644 in server,can anyone tell me why it is?



via Chebli Mohamed