anonymoussc
Aug 24, 2015 • Less than a minute read

Insert record into database using Tinker

Using laravel 5.1 we can accessing tinker. Create a model using artisan :

php artisan make:model Todolist

Newly generated file will be located at /app/ Todolist.php.

Start Tinker :

php artisan tinker

Declare namespaces and create new object.

namespace todos;

$list = new Todolist;

Assuming field record contain id, name, description, timestamps. Assign data into list object as follow.

$list->name = 'Nunquam gratia acipenser';

$list->description = 'Nunquam captis valebat';

Saving.

$list->save();

Check.

echo $list->id;

echo Todolist::all()->count();

Done.

exit;

If an NSA, FBI, CIA, DIA, etc analyst has access to query raw SIGINT databases, they can enter and get results for anything they want. Phone number, email, user id, cell phone handset id (IMEI), and so on - it’s all the same. - Edward Snowden

Post by: Anonymoussc (@anonymoussc)