laravel-4

Make multiple AJAX request using the same session

和自甴很熟 提交于 2020-02-05 06:36:15
问题 I have a REST webservice that returns an hash value based on the current http session. If I open the webservice page using a browser, I will see the same value refreshing the page or opening the page in multiple tab. This is the expected behavior because I'm using the same session on multiple request. If I do an AJAX request using the $http service of AngularJS, I obtain a different value each time. It seems that each request uses a different session. I need to obtain the same behavior like

Check for file existence if Laravel's Blade template

孤者浪人 提交于 2020-02-03 10:26:26
问题 I have a simple problem - how can I check if file exists in Laravel's Blade template? I tried @if(file_exists('/covers/1.jpg')) ok @endif But it doesn't work ( covers directory is in /public ). I also need to provide a variable ( $game->id ) to the function. Unformtunately, @if(file_exists('/covers/'.$game->id.'.jpg')) ok @endif doesn't work. 回答1: This is working for me, favicon.ico is inside public: @if(file_exists('favicon.ico')) File exists @else Could not find file @endif So I think you

How can I insert data into Database Laravel?

早过忘川 提交于 2020-02-03 05:29:44
问题 I'm new to programming. I have created a basic form inside views/register.blade.php like this @section('content') <h1>Registration Form</h1><hr> <h3>Please insert the informations bellow:</h3> {{Form::open(array('url'=>'test/register','method'=>'post'))}} <input type="text" name="username" placeholder="username"><br><br> <input type="text" name="email" placeholder="email"><br><br> <input type="password" placeholder="password"><br><br> <input type="submit" value="REGISTER NOW!"> {{Form::close(

How can I insert data into Database Laravel?

霸气de小男生 提交于 2020-02-03 05:29:09
问题 I'm new to programming. I have created a basic form inside views/register.blade.php like this @section('content') <h1>Registration Form</h1><hr> <h3>Please insert the informations bellow:</h3> {{Form::open(array('url'=>'test/register','method'=>'post'))}} <input type="text" name="username" placeholder="username"><br><br> <input type="text" name="email" placeholder="email"><br><br> <input type="password" placeholder="password"><br><br> <input type="submit" value="REGISTER NOW!"> {{Form::close(

Can I use camelCase with Laravel 4 eloquent?

假装没事ソ 提交于 2020-02-03 05:18:06
问题 I have existing data in a mysql db whose columns are camelCased. I can't change them to snake case. For instance: when I try to use "jobRole", I get "job_role". I want it to be "jobRole". Is there a setting in laravel to support this? I've read about mutators but don't understand them. Is that the solution? If so, how do I do this? 回答1: Discovered you can do this. In the model, redefine "snakeAttributes" to "false" like this: class YourModel extends Eloquent{ public static $snakeAttributes =

dump-autoload command from php

断了今生、忘了曾经 提交于 2020-02-02 11:54:53
问题 I am building a web application where the user dynamically can upload Controllers php files from the web browser. There is a problem in all of this. Since every class should be compiled in order be used inside of laravel, the commmand composer dump-autoload must be executed. But I do not want to do this manually from the terminal. Inside of a "register class" I have called explicitly some commands that have not worked for me, for example: Artisan::call('dump-autoload'); exec("/path/to/app

dump-autoload command from php

試著忘記壹切 提交于 2020-02-02 11:54:50
问题 I am building a web application where the user dynamically can upload Controllers php files from the web browser. There is a problem in all of this. Since every class should be compiled in order be used inside of laravel, the commmand composer dump-autoload must be executed. But I do not want to do this manually from the terminal. Inside of a "register class" I have called explicitly some commands that have not worked for me, for example: Artisan::call('dump-autoload'); exec("/path/to/app

dump-autoload command from php

大城市里の小女人 提交于 2020-02-02 11:54:24
问题 I am building a web application where the user dynamically can upload Controllers php files from the web browser. There is a problem in all of this. Since every class should be compiled in order be used inside of laravel, the commmand composer dump-autoload must be executed. But I do not want to do this manually from the terminal. Inside of a "register class" I have called explicitly some commands that have not worked for me, for example: Artisan::call('dump-autoload'); exec("/path/to/app

Laravel migrate unknown database

依然范特西╮ 提交于 2020-01-25 14:25:06
问题 I am having some errors with laravels php artisan migrate command, when I try to migrate, it keeps throwing errors saying, unknown database 'database name' I have checked my database configure file and even copied to a different project and it works perfectly there, I have tried composer dump-autoload command but that didn't solve the problem either. Please I will really appreciate if someone helps, since this is a new project and can't afford to lose even a minute to my deadline, thanks in

Mcrypt PHP extension required.IN Laravel With Ubuntu 14

一个人想着一个人 提交于 2020-01-25 02:57:08
问题 I am trying to migrate laravel app into ubuntu and getting error like Mcrypt PHP extension required. when i check php details with phpinfo() function it showing below screen. PLlease find the Terminal Screenshot below, php.ini How to solve this issue ? 回答1: If you have installed PHP through apt-get then find the mcrypt extension you are using either for apache by using $ locate *mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini /etc/php5/fpm/conf.d/20-mcrypt