Support the ongoing development of Laravel.io →
Requests Input Database
Last updated 2 years ago.
0

in your controller, you can do it.

$newRow = new YourModelName;
$newRow->column1 = $requesst->value1;
$newRow->column2 = $requesst->value2;
$newRow->column3 = $requesst->value3;
$newRow->column4 = $requesst->value4;
$newRow->save();

read more at laravel documentation: https://laravel.com/docs/5.2/eloquent#inserting-and-updating-models

Last updated 8 years ago.
0

jcodesdotme said:

in your controller, you can do it.

$newRow = new YourModelName;
$newRow->column1 = $requesst->value1;
$newRow->column2 = $requesst->value2;
$newRow->column3 = $requesst->value3;
$newRow->column4 = $requesst->value4;
$newRow->save();

read more at laravel documentation: https://laravel.com/docs/5.2/eloquent#inserting-and-updating-models

these is not what im trying to do

0

Well,you could use the data coming from the request and do a raw DB query. To see more aboute raw query, check this link https://laravel.com/docs/5.2/queries

An than, perform an alter table on the table you would like. Search for add column table mysql and you will see how to do it.

0
<?php

namespace App\Http\Controllers;

use Schema;
use Illuminate\Database\Schema\Blueprint;

class DatabaseTableController extends Controller
{
    public function addColumn($sTable, $sColumn)
    {
		Schema::table($sTable, function(Blueprint $table) use ($sColumn, &$fluent)
        {
            $fluent = $table->string($sColumn);
        });

        return response()->json($fluent);     
    }
}

Route:

Route::get('table_add_column/{t}/{c}', 'DatabaseTableController@addColumn');

So URL like this: http://example.com/table_add_column/users/address2 produces:

{"type":"string","name":"address2","length":255}
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ahmedEloi ahmedeloi Joined 13 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.