Twittler

Twittler

Member Since 1 Year Ago

Experience Points 900
Experience Level 1

4,100 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 2
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

21 Feb
6 months ago

Twittler left a reply on Laravel Mail Does Not Send To Mailtrap

Thanks guys for the help, i will try to upload website to host. :)

Twittler left a reply on Laravel Mail Does Not Send To Mailtrap

@BILLRIESS - Hmm, no, how do i install it?

Twittler started a new conversation Laravel Mail Does Not Send To Mailtrap

Hi guys, i'm having trouble sending mail i'm using mailtrap. Page redirects without errors and do not send mail, sometimes it says "Process could not be started [The system cannot find the path specified. ]" i have tried using mail_driver = mail but that do not work.

.env

MAIL_DRIVER=smtp

MAIL_HOST=smtp.mailtrap.io

MAIL_PORT=2525

MAIL_USERNAME=ffc415fa96e9b8

MAIL_PASSWORD=4c04fc5918df03

MAIL_ENCRYPTION= tls

Controller public function PostContact(Request $request) {

  $data = array(
    'email' => $request -> email,
    'subject' => $request -> subject,
    'bodyMessage' => $request -> message
  );

  Mail::send('emails.contact', $data, function($message) use ($data){
    $message -> from($data['email']);
    // $message -> to($data['[email protected]']);
    $message ->subject($data['subject']);
  });

  Session::flash('success', 'Your Email was sent!');

  return redirect() -> back();

}

Thanks!

03 Dec
9 months ago

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

@MUNAZZIL - Here is my restaurant controller :

namespace App\Http\Controllers;

use Illuminate\Http\Request; use App\Restaurant; class RestaurantController extends Controller {

public function index() {

    $restaurants = auth()->user()->restaurant;

    return view('pages.r-management', [
        'restaurants' => $restaurants
    ]);

}

public function PostRestaurant(Request $request) {

    $name = $request['name'];
    $address = $request['address'];
    $delivery_method = $request['delivery_method'];
    $payment_method = $request['payment_method'];

    $restaurant = new Restaurant();
    $restaurant -> name = $name;
    $restaurant -> user_id = auth()->user()->id;
    $restaurant -> address = $address;
    $restaurant -> delivery_method = $delivery_method;
    $restaurant -> payment_method = $payment_method;

    $restaurant -> save();

    return redirect() -> back();
}

}

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

@MUNAZZIL - Hi, you mean like this

class Restaurant extends Model {

protected $primarykey= 'id';

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);
}

}

, 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.

And if i'm just removing $menu -> restaurant_id = auth()->menu()->id; this line laravel says that restaurant_id is missing default value

29 Nov
9 months 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.

User Model:

class User extends Model implements Authenticatable {

protected $table = 'users';

protected $fillable = ['name', 'email', 'password', 'manager'];

use \Illuminate\Auth\Authenticatable;

public function restaurant() {

    return $this -> hasOne('App\Restaurant');
}

}

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');
}

}

Controller :

class RestaurantController extends Controller {

public function index() {

    $restaurants = Restaurant::all();

    return view('home', [
        'restaurants' => $restaurants
    ]);
}
01 Aug
1 year 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']);


}

model :

<php class Post extends Model {

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

}

and Route :

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

And sorry for dumb question.

12 Jul
1 year ago

Twittler started a new conversation Laravel Error While Migrating 42000

Hi guys, i just don't know what happened, i just migrated users file and i got this error:

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

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[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes") /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 suggestions how i can solve this?

21 Jun
1 year 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
1 year 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

class EmailSent extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'email:sent';

/**
 * The console command description.
 *
 * @var string
 */
protected $description = 'Command description';

/**
 * Create a new command instance.
 *
 * @return void
 */
public function __construct()
{
    parent::__construct();
}

/**
 * Execute the console command.
 *
 * @return mixed
 */
public function handle()
{
    $users = User::whereMonth('expiration_time', '=', date('m'))->whereDay('expiration_time', '=', date('d'))->get();

    foreach($users as $user) {

        // Send the email to user
        Mail::queue('emails.welcome2', ['user' => $user], function ($mail) use ($user) {
            $mail->to($user['email'])
                ->from('[email protected]', 'Company')
                ->subject('Date Expired!');
        });

    }

    $this->info('Birthday messages sent successfully!');
}

}

And

class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ EmailSent::class, ];

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    $schedule->command('email:sent --force')
              ->everyMinute();

    $schedule->command(EmailSent::class, ['--force'])->daily();
}

/**
 * Register the commands for the application.
 *
 * @return void
 */
protected function commands()
{
    $this->load(__DIR__.'/Commands');

    require base_path('routes/console.php');
}

}

And its not doing anything ;/

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
1 year 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. Any ideas how to fix it?

Index page :

Document

<div class="container">
    <div class="row">
        <div class="col-sm">
            <table>

                <form action="store" method="post">

                    <label for="name">Vardas</label>
                    <input type="text" name="name"> <br>

                    <label for="last-name">Pavarde</label>
                    <input type="text" name="last_name"> <br>

                    <label for="email">email</label>
                    <input type="text" name="email"> <br>

                    <label for="tel.nr">tel.nr</label>
                    <input type="text" name="tel.nr"> <br>

                    <label for="select">Plano pasirinkimas</label><select>
                        @foreach($hostings as $hosting)
                        <option value="{{$hosting['id']}}">{{$hosting['pavadinimas']}}</option>
                        @endforeach
                    </select>
                    <br><input type="submit" value="Pateikti">

                    {{csrf_field()}}

                </form>

            </table>
        </div>
    </div>
</div>

Routes: Route::get('/home', '[email protected]'); Route::get('/create', '[email protected]'); Route::post('/store', '[email protected]');

PostController:

public function index()
{
    return view('index');
}

/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create()
{
    //
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{

    Posting::create(Request::all());
    return view('index');
}

Model:

class Posting extends Model { protected $primaryKey = 'id'; protected $table = 'client'; public $fillable = ['id','host_id','vardas','pavarde','Tel','email']; }

11 Jun
1 year 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.