laravel

Why does php artisan migrate nothing?

99封情书 提交于 2021-02-08 14:00:12
问题 Running "php artisan migrate" does nothing: no database modifications, no message(olso no "nothing to migrate"), no error. No records are being added to table migrations as well. Previously, the command "php artisan migrate" was working fine. One of the migration files in folder database/migrations has this content: <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class VidsTableEdit14 extends Migration { /** * Run the migrations. * * @return void

Call to a member function move() on null

大城市里の小女人 提交于 2021-02-08 13:54:41
问题 I cannot figure out how to resolve this issue. It seems when I try to create my article page if I don't select a img it fails with null error. Anyone have any insight? Error Is Produced via debug mode. Call to a member function move() on null. /home/UNIT3D/app/controllers/Admin/ArticleController.php $post->image = null; } $v = Validator::make($post->toArray(), $post->rules); if($v->fails()) { // Suppression de l'image car la validation a échoué if(file_exists(Input::file('image')->move(getcwd

How to seed pivot table in Laravel 5.4?

穿精又带淫゛_ 提交于 2021-02-08 13:04:41
问题 I am following a tutorial called Incremental API in laracasts by Jeffrey Way. There is a different coding between Laravel 4 faker class seeding and laravel 5.4. I still followed the same code lines from the tutorials "Seeders Reloaded". Now, I am stuck with "Class LessonTagTableSeeder does not exist" TagTableSeeder class TagsTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create('App\Tag'); for($i=1; $i <= 10; $i++) { DB:

Laravel query multiple tables using eloquent

你说的曾经没有我的故事 提交于 2021-02-08 12:20:33
问题 hi sorry bit of a newbie here but I am have three tables users, profiles, friends. they all have the user_id fields within them and I want fetch all of the fields in one statement using Eloquent and not DB::statement and doing the table joins. How can I achieve this? 回答1: Try this use the User class and the with method that laravel has to query model relationships $user = User::with(['profile', 'friend'])->get(); Ensure your models has the correct relationships as follows: app/models/User.php

GET request array to table in PHP

倾然丶 夕夏残阳落幕 提交于 2021-02-08 11:57:53
问题 I'm trying to create an html table based on the results from an array from a GET request. I have tried for loops and I have tried Java examples, but the results are always displayed as a long string (or if I return the results as dd($response) it only returns one row. I was wondering if there is a problem with the way format the array is returned: { "results": [ { "column1":"TEST1", "column2":"DATADATADATA", "time":"2017-02-27T16:25:03.1230000Z" }, { "column1":"TEST2", "column2":"DATADATADATA

Why am I getting this laravel url routing error in .htaccess?

。_饼干妹妹 提交于 2021-02-08 11:49:17
问题 I have recently installed Laravel into my public_html folder. I want it so when I log into www.malhub.com it gets the contents of the public folder (public_html/public). After trial and error, I was able to get it working somewhat. Now I have a 404 error, which is caused because the site (www.malhub.com) resolves to : http://malhub.com/public/public_html But my .htaccess code states: RewriteRule ^(.*)$ public_html/public/$1 [L] In other words, it looks for a public_html folder within the

Why am I getting this laravel url routing error in .htaccess?

谁说胖子不能爱 提交于 2021-02-08 11:48:58
问题 I have recently installed Laravel into my public_html folder. I want it so when I log into www.malhub.com it gets the contents of the public folder (public_html/public). After trial and error, I was able to get it working somewhat. Now I have a 404 error, which is caused because the site (www.malhub.com) resolves to : http://malhub.com/public/public_html But my .htaccess code states: RewriteRule ^(.*)$ public_html/public/$1 [L] In other words, it looks for a public_html folder within the

Laravel REST API Testing in phpunit

别说谁变了你拦得住时间么 提交于 2021-02-08 11:31:29
问题 I am trying to test a Laravel REST API, through phpunit. While testing REST calls, I am unable to isolate REST calls test. In Laravel, I understand a few options like using traits DatabaseMigrations , DatabaseRefresh , DatabaseTransactions . But I can't use these for the following reasons: DatabaseMigrations : The app does not have proper migrations. Even if it had, those would be quite in-efficient. DatabaseRefresh : Same as above. DatabaseTransactions . The problem I see is that call to

What is the best way to restrict access in Laravel?

余生长醉 提交于 2021-02-08 11:05:34
问题 I am designing a website where only logged in user can access the content of some parts of the site.So which of the following method is more secure and a industry standard? Method 1: Checking if the user is logged in and doing something like the following in a view: @if (Auth::check()) // content for logged in user @else // Access restricted warning message for guests @endif Method 2: Using the route technique Route::get('study',array('before'=>'auth','uses'=>'home@study')); And there is no

What is the best way to restrict access in Laravel?

╄→尐↘猪︶ㄣ 提交于 2021-02-08 11:02:14
问题 I am designing a website where only logged in user can access the content of some parts of the site.So which of the following method is more secure and a industry standard? Method 1: Checking if the user is logged in and doing something like the following in a view: @if (Auth::check()) // content for logged in user @else // Access restricted warning message for guests @endif Method 2: Using the route technique Route::get('study',array('before'=>'auth','uses'=>'home@study')); And there is no