Twittler

Twittler

Member Since 6 Months Ago

Experience Points 800
Experience
Level
Lessons Completed 2
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

03 Dec
1 week ago

Twittler left a reply on Laravel How To Put Restaurant Id To Menu Table Restaurant_id

@MUNAZZIL - Hi, you mean like this , because i'm still geting error " Method Illuminate\Auth\SessionGuard::menu does not exist."

Twittler started a new conversation Laravel How To Put Restaurant Id To Menu Table Restaurant_id

Hi guys, i'm having problem taking id from restaurants table and putting it to menu table Restaurant_id.

Restaurant model:

class Restaurant extends Model {

protected $table = 'restaurant';

protected $fillable = ['name, address, delivery_method, payment_method'];

public function user() {

    return $this ->belongsTo('App\User', 'foreign_key');
}

public function menu() {

    return $this -> hasMany(Menu::class);
}

}

Menu model:

class Menu extends Model { protected $table = 'menu';

protected $fillable = ['restaurant_id', 'name', 'ingredients', 'price'];

    public function menu() {

    return $this -> belongsTo(Restaurant::class);
}

}

Menu controller :

public function PostMenu(Request $request) {

    $name = $request['name'];

    $menu = new Menu();
    $menu -> name = $name;
    $menu -> restaurant_id = auth()->menu()->id;

    $menu -> save();

    return redirect() -> back();

}

And if i'm using $menu -> restaurant_id = auth()->user()->id; it just takes id from user table.

29 Nov
2 weeks ago

Twittler started a new conversation Laravel Display Restaurants By User_id

Hi guys, i need to display restaurants uploaded by user but i having some problems with finding user_id, with $restaurants = Restaurant::all(); works just fine but then showing all restaurants in db.

Model :

class Restaurant extends Model {

protected $table = 'restaurant';

protected $fillable = ['name, address, delivery_method, payment_method'];

public function user() {

    return $this ->belongsTo('App\User', 'foreign_key');
}

}

Controller :

class RestaurantController extends Controller {

public function index() {

    $restaurants = Restaurant::all();

    return view('home', [
        'restaurants' => $restaurants
    ]);
}
01 Aug
4 months ago

Twittler left a reply on Trouble Deleting A Post

Thanks That worked !

Twittler left a reply on Trouble Deleting A Post

I tried dd($post);

and i get null. How can i solve this?

Twittler started a new conversation Trouble Deleting A Post

Hi guys, i'm having a strange error while deleting a post, it seems i cant select db value can u help me with this. dd($posts->exists) shows false and i confused why.

Controller :

<php public function getDeletePost(Post $post_id) {

    $post = Post::where('id', $post_id)->first();
    dd($post_id->exists);
    //$post->delete();

    return redirect()->route('dashboard')->with(['message' => 'post deleted']);


}

php>

model :

class Post extends Model {

public function user() {
    return $this -> belongsTo('App\User');
}

}

and Route :

Route::get('/post-delete', [ 'uses' => '[email protected]', 'as' => 'post.delete', 'middleware' => 'auth'

And sorry for dumb question.

12 Jul
5 months ago

Twittler started a new conversation Laravel Error While Migrating 2002

Hi guys, i'm using MAMP for database, and i just can't migrate databases, i dont know why i tried DB_HOST=localhost, DB_HOST=127.0.0.1. And it all the same, here the code what i'm using:

.env: DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=test DB_USERNAME=root DB_PASSWORD=root

database.php

'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '3306'), 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock', 'database' => env('DB_DATABASE', 'test'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', 'root'), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ],

and i'm getting error:

php artisan migrate

Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users (id int unsigned not null auto_increment primary key, name varchar(255) not null, email varchar(255) not null, password varchar(255) not null, remember_token varchar(100) null, created_at timestamp null, updated_at timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

at /Applications/MAMP/htdocs/RunescapeTips/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {

664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|

Exception trace:

1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists") /Applications/MAMP/htdocs/RunescapeTips/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

2 PDOStatement::execute() /Applications/MAMP/htdocs/RunescapeTips/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

Any help? thanks.

21 Jun
5 months ago

Twittler left a reply on Laravel Undefined Variable:

Yeah guys thank you all very much, that was silly me, i forgot to change route to Route::get('/list', '[email protected]');

Thank you all.

Twittler left a reply on Laravel Undefined Variable:

yeah it has no data ;/

Twittler left a reply on Laravel Undefined Variable:

Thats even dummier question from me where i suppose to put this

$posting = posting::all(); dd($posting)

in controller like this?

    $posting = posting::all();
    dd($posting)
    return view("lists.list",compact("posting"));

Twittler started a new conversation Laravel Undefined Variable:

Hi guys, just got a nooby problem, i cant fetch data from db, but the strange thing is in other folder i used

Controller:

    $hosting = hosting::all() -> toArray();
    return view("index",compact("hosting"));

View:

@foreach($hosting as $host) {{$host['pavadinimas']}} @endforeach

And that worked, right now i want to make a list and i using

Controller:

    $posting = posting::all() -> toArray();
    return view("lists.list",compact("posting"));

View:

@foreach($posting as $post)

<p>{{$post['vardas']}}</p>
@endforeach 

and it;s giving me error " Undefined variable: posting (View: C:\xampp\htdocs\praktika1\resources\views\lists\list.blade.php)"

and i don't understand what i have done wrong?

18 Jun
5 months ago

Twittler left a reply on Sending Email With Expiration_date

When i try run it i get

          • php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1 Cannot run program "*" (in directory "C:\xampp\htdocs\praktika1"): CreateProcess error=2, The system cannot find the file specified

Twittler left a reply on Sending Email With Expiration_date

So i created command with

php artisan make:command EmailSent --command=email:sent

and having

Twittler started a new conversation Sending Email With Expiration_date

Hi guys, need some advice once again, i have database with created_at and expiration_date, how do i send email when date expires?

17 Jun
5 months ago

Twittler started a new conversation Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails

Hi guys, i'm having " Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails" problem when i try to send data to database.

11 Jun
6 months ago

Twittler started a new conversation How To Send Email When Subscription Ends?

Hi guys, can you help me? How do i send email when users subscription ends?

Sorry for that dumb question i'm new to laravel ;/

Thanks.